Technical FAQs

Q. Are a single servo motor, the ping sensor and a piezo buzzer too much for the arduino 5V to handle, that is, will it be too much power for the board to provide?

Sensor and the buzzer should be fine. Whether a servo would be ok or not depends on how big the servo is and what kind of load it has to take. If a small servo was being used to simply rotate a ping sensor for scanning, it may be ok. But, all depends on current draw. Remember that Arduino ports can not supply more than 40 mA, and the maximum USB port can supply is 500 mA.

Q. Are we allowed to use multiple on-off switch (As in, a permanent state switch) connected to our power source as opposed to the push-button (momentary switch)? To make our code less cluttered, it would be easier for us to have a circuit solution like this, so that our robot may run the length of the code, and simply need to be switched off, then on again to repeat?

You can use a momentary or a toggle switch to initiate action. However, after that your program should take control of stopping the action.

Q. Will connecting a 9 V to a 5V servo damage it??

Most are rated from 4.8V to 6V - giving the servo 9V risks burning it out or lowering its life. Connecting it to a 4 AA battery pack is a better option.

Q. Do I really need to have a separate power source for my dc or servo motors? Can I not power them from Arduino?

It is important to separate power supply for both DC and servo motors.

You can power your arduino using a 9V battery and that would be ok, but motors draw a lot of current and Arduino can not supply that kind of current.

If you are using servos from the project kit, they are 4.8-6V servos, which means that you can use 4AA battery pack to power them -- 4 AA would give you 6V.

Avoid using alkaline 9V battery to power motors as they do not have enough charge capacity and they can not supply current like AA batteries can.

Just make sure that you connect all grounds together -- that is of Arduino, all batteries, otherwise it would not work.

Q. I wrote following code for controlling my servo, but my servos do not respond according to the code:

for (pos = 0; pos < 180; pos += 20) // goes from 0 degrees to 180 at an interval of 20 degrees

{ // in steps of 1 degree

myservo.write(pos); // tell servo to go to position in variable 'pos'

delay(15); // waits 15ms for the servo to reach the position

}


If the step/interval size is larger than 10 degrees, the range of motion a servo could reduce. Lower step size is better for the servos. For the servo in the project kit, this is the data: speed: 0.22sec/60°

One pulse for a servo is 20 ms = 0.02 s, that means that in that time, the servo can move at most = (60/0.22) * 0.02 = 5.45 degrees. Anything larger, the servo will have trouble with. Change the code to following and it should work fine:


for(pos = 0; pos < 180; pos += 5) // goes from 0 degrees to 180 degrees in steps of 5 degrees; do not go above this step size; lower is better

{

myservo.write(pos); // tell servo to go to position in variable 'pos'

delay(15); // waits 15ms for the servo to reach the position

}


Q. In my code, I am keeping track of time by doing this:

int time = millis(); // this gives current time

However, after a while, the program acts weird. Why?

Declare your time variable to be a long int as an int can hold up to a maximum value of 32,767, which means that soon after your 32 seconds are up, the time variable will overflow and reset to zero. A long int can hold values up to 2,147,483,647, which should suffice in most situations.

Q. When wiring two DC motors to the same H Bridge, do you need to hook up two 9V batteries, one for each motor?

Each H-bridge can accommodate only one external power source.

Q. How should I write my program so that when I push a button, the motion along with the led will sustain for at least 30 seconds and then come to a stop?

Here is one idea on how to time your robot's motion etc.:

startTime = 0; // initial value


void loop()

{


time = millis(); // this gives current ime

Serial.print("time: ");

Serial.println(time);

// Stop doing whatever you are doing in 30 seconds after button is pressed

if (time >= (30000 + startTime))

{

end();

}

// here do robot motion, detect sensors, play sound, light up LEDs, go crazy here

}

In above end() is a function where you can stop all motor and led activities.

Q. How does one go about soldering a capacitor across the terminals of a DC motor?

Some students make the mistake of adding a capacitor on the breadboard across the motor terminals. That does not have the intended effect. You DO need to actually solder the caps across terminals on the motor.

There will be no harm if you placed them on the breadboard, but the caps need to be as close as possible to the source, i.e., motor to be effective. Motors are basically both resistive and inductive devices that rapidly cause breakdown of magnetic field inside the motor due to commutator-brush contact switching. This lead to spike in voltage. Caps smoothen these spikes out.

Q. Is it possible to include audio in our robot or is the Arduino Uno not capable of it?

Yes, you can include audio. See the following tutorials on how to do that using a pizzo or a speaker:

https://learn.adafruit.com/adafruit-arduino-lesson-10-making-sounds

http://www.instructables.com/id/Arduino-Basics-Making-Sound/

Q. I have a servo and an LED connected on pin 10 and am trying to control LED's brightness using PWM. But, I can not. Why?

If you can not control the brightness of the LED using PWM, make sure that you are not connecting it to pin 9 or 10 as you can not do a PWM on those pins when you use a servo library. See this reference:

http://arduino.cc/en/reference/servo

The Servo library supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega. On boards other than the Mega, use of the library disables analogWrite() (PWM) functionality on pins 9 and 10, whether or not there is a Servo on those pins. On the Mega, up to 12 servos can be used without interfering with PWM functionality; use of 12 to 23 motors will disable PWM on pins 11 and 12.

Q. How many sensors should our project include?

Minimum is 1, but you can have more. However, the sensors should enhance the robot's functioning and control the motion.

Q. Do the little lines next to the pin numbers like 11, 10, 9, mean anything or are they just regular pins like 12 and 13?

The pins with a wave sign next to them are called PWM (Pulse Width Modulation) pins. They can be used as regular pins. But, they also have the added functionality that you can write a variable voltage between 0 to 5V on those pins using analogWrite function. This is useful for dimming an LED, controlling the speed of the motor, etc.

Q. I have a need for multiple motors in my robot and I would rather not use H-bridge IC. Can you recommend a motor shield?

There are many motor shields out there. Here is one that is quite popular: http://www.adafruit.com/products/1438 and another good one is http://www.makershed.com/Official_Arduino_Motor_Shield_p/mksp12.htm

Q. How do I play music or sound using Arduino?

You can use the piezo in the kit; see instructions here: http://www.arduino.cc/en/Tutorial/PlayMelody or http://www.hobbytronics.co.uk/arduino-tutorial7-piezo-beep

You can also use Adafruit Wave Shield for Arduino Kit http://www.adafruit.com/products/175

Q. Why do I have to solder ceramic capacitors across my DC motor terminals?

The short answer is to protect your electronics circuit and microcontroller from the harmful electrical noise produced by the DC motors. For a longer answer, see this article on dealing with motor noise http://www.pololu.com/docs/0J15/9

Q. Which CAD software can I use for modeling my robot or its parts?

Using a CAD software for the design project is not required. You will learn CAD later on. However, should you wish to learn one, there are many CAD softwares out there. Solidworks is #1 software in usage among industry and it's easy to learn and use. But, it's not free -- a student version costs $100. On the other hand, Autodesk Inventor is free and although it Is relatively a new entrant to the market, it is very capable and should be sufficient for this class. Blender is another free CAD tool. You can also try simpler CAD tools, such as google sketchup or online CAD tools, such as tinkerCAD.com, Autocad360 https://www.autocad360.com/.

Q. Which mechanism design software can I use for designing, and analyzing mechanisms for my robot?

See the MotionGen tab.

Q. Should we include the components of the Arduino kit that we used in our robot even though they were provided to us or should we leave these out?

You should include all of the available information for every part, even if it came in the provided kit. Basically, the Bill of Materials should contain all of the parts information someone else would need to build an exact replica of your project.

Q. I have seen analog pins on Arduino referred to as A0 or 0? What is the difference?

Per this page (http://arduino.cc/en/Tutorial/AnalogInputPins) , following distinction exists between using an analog in pin vs using the same pin as digital in/out:

The analog pins can be used identically to the digital pins, using the aliases A0 (for analog input, use 0, 1, etc.), A1, etc. For example, the code would look like this to set analog pin 0 to an output, and to set it HIGH:

pinMode(A0, OUTPUT);

digitalWrite(A0, HIGH);

On the other hand, if you want to use A0 pin as an analog in pin, use following code (this is how you should read if you are using a sensor):

const int sensorPin = 0; // set the pin number

sensorValue = analogRead(sensorPin)

Q. If I program the photocell to react to certain values in one room, but our room for the demonstration is dimmer than the room i programmed it in, will it affect how the actuators function? If so, does anyone have any suggestions on how to compensate for this issue?

Write your program in such a way that, for a second or so, photo cell just collects data, averages out the readings, thus understanding the ambient light, and then based on that it makes the adjustment.

Q. I downloaded the software from the arduino website and when the file opened on my windows computer I came across a few difficulties. The file that opens is a zip file and I am not sure how to access the actual arduino program from there.

see this page for on how to install drivers and set up your software:

http://arduino.cc/en/Guide/HomePage

Q. Could a complex array of LED lights performing a certain pattern be a substitute for an actual mechanical motion?

A complex array of LED lights performing a certain pattern will not be acceptable since movement of a pattern is not really a mechanical motion.

However, you can have these LEDs accompany an actual motion for added effect.

Q. I understand we cannot use a connected power source for our finished project but are there any restrictions to the voltage and the amount of batteries we are allowed to use?

To power Arduino, you are restricted to use whatever source Arduino accepts. We usually use no less than a 9V battery for powering Arduino. For motors and other actuators, you are advised to use a separate battery pack.