This is Scout...an obstacle avoider that can log temperature and talk!
He can talk using a wave shield.The speaker used is rated 1/2W and 8 ohms.For the chassis I used a 4mm thick acrylic sheet (about 22cm X 20cm)...right now the chassis is only temporary as I plan to make a more robust one.
I used the TTS from here and saved the WAV files on to the SD card.
Some of his features are :
- He can talk ( and make R2D2 sounds sometimes )
- Avoids obstacles using the HCSR04 ultrasonic sensor.
- Has an rgb led that glows blue when friendly and red when angry.
Code and sound files attathced. :)
On to the parts list..
Step 1: Parts & Tools
Here's a list of the components used :
- 4mm thick acrylic sheet for the chassis (22cm X 20xm)
- Arduiuno Uno
- Rgb Led
- HCSR04 Ultrasonic Sensor
- 1/2 W 8 ohm speaker
- Wave shield ( I soldered one using the adafruit schematic )
- SD card
- LM35 temperature sensor
- Audio Amplifier ckt (parts list below )
- 2 x BO motors
- 2 X BO motor wheels
- 9g Servo
- 7.4v LiPo for the motors and Arduino
- 4 x AA battery pack for the Audio Amp ckt
- Caster wheel
- BO servo mounts
- L293d motor driver IC
- 3 x 8 pin IC Sockets
- 2 x 16 pin IC sockets
- Male and Female header pins
Parts List for the Audio Amplifier :
- 10uF electrolytic capacitor
- 0.1uf ceramic capacitor
- 10K ohm pot
- 10 ohm resistor
- 220uF electrolytic capacitor ( I used 2 x 100uF caps in parallel since they were at hand )
- male and female header pins
Tools and other misc stuff :
- Soldering Iron
- Arduino IDE ( make sure you have an older version like 0022 since the ServoTimer2 library doesnt compile on the newer IDEs)
- Glue gun
- Solder wire
Step 2: Soldering the Wave Shield
You could either buy your own wave shield or solder it from scratch.Since I had most of the components at hand I decided to give it a try and soldered it.The only component I had to order was the DAC chip.
I replaced the TS922 op-amp with the lm358 since they had identical pin outs...the only draw back was that there was a reduced output volume when I used it with the speaker.(Volume for the headphones was fine.)
I wont go into the connections since the schematic is available on the adafruit tutorials page.
The only tricky component to solder was the SD card socket since it had very tiny pins.
Step 3: Making the Audio Amplifier Board
The audio amp ckt uses the LM386 ic which is a popular audio amp.
The circuit connections for the amplifier was a google search away..I've attached the schematic I ued to make mine.
The only electrolytic capacitor values I had at hand were in multiples of 10 (10uF,100uF,1000uF)...therefore worked around values given in the schematic.For example I used 2 X 100uF capacitors in parallel intead of 220uF and instead of 0.05uF I used a 0.1uF ceramic capacitor.The only downside to this was that the speaker produced a faint hum when there wa no signal...no biggie.
The pictures will serve as a better guide to make the circuit :)
Step 4: Connecting and Mounting the Motors
Make sure you've connected three 0.1uF caps on the motor terminals (as shown in the picture)...this eliminates most of the noise generated by the motors.
Use the BO clamps and screw the motors on to them tightly...then glue the clamps on to the chassis making sure both motors are parallel to each other.
The motor terminals are connected to the output pins of the L293D motor driver.
Once the motors are placed on the chassis...mount the caster wheel and put the wheel on the motors.
Step 5: Servo and Distance Sensor
For the head I used a 9g servo on to which I mounted the HCSR04 distance sensor using a piece of plastic and a servo horn.
The servo signal pin goes to pin 6 on the arduin and the HCSR04 goes into two analog pins.
I also added a rgb led at the back to improve the appearance and to try and mimic blinking while the robot speaks...the led also shows different moods...Blue when friendly...Red when angry.
Step 6: Code and Pin Connections
Before you upload the code on to the arduino make sure you have downloaded and installed the libraries required into the libraries folder in the main Arduino folder on your PC.
The libraries required are :
Also make sure not to change any of the sound files names...since they have to be identical to the ones in the code.
The pin connections of the L293D are as follows :
- Enable pins(1,9)---------> +5v
- Input 1--------> Digital pin 9
- Input 2--------> Digital pin 19
- Input 3 --------> Digital pin 5
- Input 4 --------> Digital pin 3
You can change the pin numbers to any other digital pin as long as it doesnt overlap with the pin used by the wave shield.
Follow the adafruit tutorial for setting up the SD card and converting sound clips to WAV files as they've covered these topic very well.
I'm still working on the code right now...will update this section in a day or two!
Step 7: Sound Files
I've attatched the R2D2 sound files(WAV format) in this step....make sure you format the SD card first and then save them.
No conversion is required as they are already in the WAV format.
Step 8: Final Setup
Once all the circuit boards are ready mount them on the the chassis using spacers or screws.
I used two screws to mount the speaker in place.Once everything iis mounted upload the code on to the Arduino and connect the power supplies.
Make sure the power supply for the Arduino and the Amplifier ckt are separate.
For converting and playing files :
For the file conversion I used Audacity (adafruit has a good exaple on how to use it here .)...simply ave your converted files on to the formatted SD card.
Note : The sound file names should be identical to the ones in the code.
Hope y'all enjoy making this bot :)