Here is the video:
After first round of prototyping, I decided to make the device hand-held instead of connecting to the power box.
So I decided to tape the arduino board on the back of the breadboard and use a 9V battery. The plan is to power the speaker and IR sensor using the Arduino and to power the two servo motors by the 9V battery. This means I need to plan out my circuit layout on the breadboard.
This leads to multiple problems:
1. My transistor got really heated. Initially I plugged the +/- wires to the breadboard. Then I tried the embedded power input and use the Vin pin to power the arduino, but unfortunately the same problem occurs. This also leads to my second problem ->
2. My arduino port was not recognized by the program. The error message was:
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
This problem has occurred before when I burned the arduino, so I thought the same thing was happening. But the led light on the arduino was still lit so I decided to google and look into the problem. I did the following things and nothing worked:
– check that I have the right board and port selected in the GUI
– exit Arduino software, disconnect Arduino USB, wait a minute, reconnect and try again
In the end, I unplugged every pin that was connected to the arduino and it worked! And I plugged back the pins one at a time to see what exactly was causing the problem. I came to the conclusion that my arduino could not handle two servo inputs.
To be safe, I decided to get rid of the transistor and go back to using the external power box instead.
3. Servo twitching. I initially mapped my IR read data to a servo range of 0-180, and the servo would twitch and have negative values. I then realized the particular servo I selected had a range of -90~90.
4. I also shortcircuit-ed one of my servos, but my arduino could not handle 2 servos anyway, so I had to rely on the one servo to perform.
- Do not glue your parts until your are certain the circuit would work. I could have switch out of my burned servo, but I hotglued it for my prototype and it became a restraint.
- Be careful when using external power. I have yet to figure out what is wrong and what a better alternative would be.
- Wiring should be as simple as possible. I was using a lot of wires to connect things where instead I could have plugged the +/- wires directly into the +/- on the breadboard.