FAQs

These are actual questions that students have asked me in the past during the course of this project.

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. Rule # 2 in the project description says:

There has to be a switch on board that when pressed will initiate the motion that should last no less than 30 seconds and no more than 60 seconds. Program it so that it comes to a stop at the end of 60 seconds.

Q. What exactly is a design notebook?

It's a notebook that each student will have to maintain documenting their design work. Think of it as a log book.

Q. Instead of using a 4 AA battery holder to create a 6V battery source, will using two 2 AA battery holders in series have the same effect?

Yes -- same effect. A 4 AA Battery holder creates a series circuit of 4 AAs only. If you have such a holder, you can actually see that '+'ve terminal of one battery would be connected to '-'ve terminal of another and will continue this pattern until the last battery.

So, this would be a good way to create even 9V or 12 V sources. Each of you have a 2AA battery holder in your own kit. So, if there are 4 members in your team, you have a total of Four 2AA holders giving you a capability to create 8AA battery holders yourself. Just make sure that all the batteries are identical -- of same chemistry with same charge level. Tape the pack with electric or duct tape around all of them, solder wires together (this would be a nice way to practice your soldering skills), and voila you have got a battery holder. Too bad if they discharge, you would have to start all over again. :-)

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. The QTR Line Sensor Array comes with a header which can be through-hole soldered into the sensor like the example from the PowerPoint. However, the pins on the header still need to be attached to the arduino, and the pins are very close together, so I am nervous about soldering wires to the pins. I am wondering if there is a part that has pin holes on one side and wires coming out the other (similar to our servo motors) so that I don't have to solder every one of the pins to wires (we are using 5 of the 8 sensors, and one for 5V and ground). Is there such a part, and if so what is it called? Could I get it at a local store?

Once you have the header soldered to the array, you can use male to female wires to make connections, like these: http://www.amazon.com/Jumper-Wires-Premium-200mm-Female/dp/B008MRZSH8

There are also Female machine pin headers that are very convenient to use; see this link https://learn.sparkfun.com/tutorials/connector-basics/pin-header-connectors andhttp://www.allelectronics.com/make-a-store/item/con-2310/10-pin-connector-w/header-0.156/1.html

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

I have spoken about the importance and often the necessity of using a 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.

If you are using DC motors from the kit, they are 12V motors, so ideally speaking you should be using a 8AA battery pack or at least a 6AA pack.

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. What those rectangular metal bars with consecutive holes are called and where I can possibly get some for prototyping my robot?

They are called erector sets available at many places. Example: http://www.amazon.com/s/ref=nb_sb_noss_2?url=search-alias%3Daps&field-keywords=erector

Or, you can buy actobotics from servocity.com

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. The specific sensor we are using isn't in the fritzing database (QTR Analog Line Sensor Array). Since we are using 5 sensors on the array, should we pick 5 of the same sensor on fritzing (whatever we can find) to represent each sensor on the array, or can we use one sensor to represent the entire array?

Pololu_QTR8A_IR_Sensor_Array.fzpz is the fritzing diagram for that sensor found at https://code.google.com/p/fritzing/issues/detail?id=875&cnum=500&cstart=512

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. Where can I buy a shaft coupler for our motor, so we can attach a shaft to a motor?

Amazon.com has an industrial and scientific store front at http://www.amazon.com/industrial-scientific-supplies/b/ref=dp_brw_link?ie=UTF8&node=16310091

See this as well: https://www.servocity.com/html/hubs__couplers___adaptors.html

If nothing else, improvise. Create a temporary collar for the shaft using a piece of plastic, cardboard. Or, use glue gun. Or, tape the shaft with electric tape.

Q. How can I put the HC-SR04 ultrasonic sensor in our fritzing diagram?

See this link: http://fritzing.org/projects/hc-sr04-project

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 in sophomore year. 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?

Additionally, if our prototype contained pieces of wood and metal, but these were recycled from scrap, would the section for the part number be left blank?

You should include all of the available information for every part, even if it came in the provided kit. For wood and similar materials just provide the dimensions. 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. Is there a place on campus where I can work with my team mates?

If you are looking for a place to work with your team mates, check out one of these CoLA locations:

https://tlt.stonybrook.edu/Facilites/Group/Pages/default.aspx

CoLAs are facilities designed to assist students who need to work in groups for projects or study. They are located at different sites around the University and may have one or more of the setups listed below within them.

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.

Alternatively, you can just test it in the class on any day (preferably on the pre-demo day) and calibrate your program.

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. How do I connect Arduino to battery?

I strongly advise that you use USB power for powering Ardunio while you are testing your project. However, for actual demo, you will need to hook up an external 9V battery to power the board and another 12 V battery for motors, etc.

There are two ways you can connect a battery to power the board:

Option 1. Wire and solder the battery to the DC barrel plug (in the kit) and plug in to the DC port. See this tutorial:

http://www.ladyada.net/learn/arduino/starterpack.html#battpack

Option 2. Directly insert red wire from the wire snap (in the kit) to Vin on the board and black one to the ground on the board.

See this link for a tutorial on how to directly connect your battery to your Arduino board.

http://www.instructables.com/id/Powering-Arduino-with-a-Battery/

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

Read the project description carefully. According to that "a complex array of LED lights performing a certain pattern be a substitute for an actual mechanical motion?" 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. Are the proposals set in stone? Can we add some modifications to the project if we find that we have time to add something more?

No, they are not set in stone or cheese. The proposal is merely for me to give you a go or no go to work on your project. I would like to make sure that you are choosing something that fits the bill and is not too difficult or too simple to achieve. You are free and actually encouraged to add things to your project for further enhancements without sacrificing the core motion that you promise in the proposal.

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 and and I will provide a battery compartment with an on and off switch for a 9V one. For motors and other actuators, you are advised to use a separate battery pack.

Q. What is the difference between a functional and entertaining motion?

A functional movement is meant to accomplish a function, such as walk along a line or a curve, lift something, do this or that. An entertaining movement is the one which seem to have no functional purpose except to amuse you. Given the subjectivity behind an amusing motion, we define amusing as something that a three year old would find interesting.