Hello there fellow makers,
I wish to share some experience that I've gained while working on my Bob The Robot project, which led me to use 2 Arduino's.
Short version: because it looks like a fun project.
Long version : I ran out of memory while trying to send/receive IR data & playing wave files at the same time. I've also encountered issues related ot atmega328's limitations. So I thought that it would be a great idea to use one Arduino to do the IR communication and robot logic (the master) and the other one to play audio and turn motors on and off (slave).
Basically you can use a pair of arduino uno's or nano's and connect them via I2C. To add more challenge I've designed a circuit which contains two atemga328's, a connection to an SD card module and 5v regulator. After reading this instrucatble you'll be able to create you very own dual (or maybe quad?) core arduino from scratch!
For the Arduino's (you can use an arduino uno board instead but you'll miss the fun!)
- 2x ATMEGA328P-PU
- 2x 16MHZ crystal
- 4x 22pF ceramic capacitors
- 2x 10k resistors
- 2x Tactile Push Button Switch
For the power supply/regulator you'll need the following parts (you can use existing 5v power supply if you wish):
- 10uF electrolytic capacitor
- 1uF electrolytic capacitor
Additional parts required :
- SD/Micro SD card module for Arduino (SPI Interface)
- USBISP AVR Programmer to program the chips
- SD/MicroSD card with audio files
- 3x LEDs
- 3x 330 ohm resistors
- some breadboard wires
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Start With One Core and Make It Blink!
To keep things simple, we'll start with a single Atmega328p chip and make it blink. Follow the circuit diagram provided in this step, then connect the AVR programmer and upload the blink program.
Please note that the LED is connected to digital pin 3 in the circuit, so you'll have to change your blink code accordingly. If you wish to use digital pin 13 like in the original arduino blink sketch connect the LED to pin 19 (SCK pin).
With some luck, you should have a blinking LED!
Some tips for this step :
- Keep it simple and check every step
- If you're using lm7805 wire it before you plug into the atmega328p, make sure that you get a 5V output
- If you encounter issues with the blink program, try uploading the arduino bootloader to the atmega328p (tools>burn bootloader)
- Drivers for USBISP can be found here. Follow this guide on driver installation for Windows 8
Step 2: Add the Second Core and Make It Blink Also
Now that we have one LED blinking, repeat what you did in the previous step and add the second Atmega328p, with its crystal and capacitors and make it blink.
Programming the second arduino :
Basically you disconnect the USBISP from the first chip and connect it to the second chip in order to program it. Its not very convinient to rewire the ISP every time you wish to switch the chips. So what you can do is connect the ISP to both of the IC's and disconnect the SCK (serial clock) of the chip you don't want to be programmed.
You should have now two LEDs blinking and you should be able to switch between the chips while programming by connecting and disconnecting the SCK pins.
Step 3: Let Them Talk
Now that you have both Arduino's happy and blinking, which is a nice accomplishment. Now lets make them talk! We'll make one arduino as the master and the other one will act as the slave. The master will send data to the slave.
Connecting the chips is really simple. Just connect the SDL and SCL pins between the chips.
Now that everything is connected its time to send some data!
You should see a blinking LED on the slave. Notice that the LED connected to the slave chip is controlled by the master :)
Step 4: Add an Sd Card and Play Some Music
This would be the last step in this instructable, if you have reached so far you should be really proud of yourself!
This step should be an easy one :
- Connect SD card module to the slave chip as described in the circuit provided with this step
- Connect the speaker to the slave chip ( be careful, use a small 8 ohm speaker or headphones )
- Upload .wav files to the SD card. The files should be 8 bit 32k .wav file
- Upload this code to the master, make sure that you have the file 'hello.wav' uploaded to the SD Card
- Upload this code to the slave, make sure that you have TMRpcm library installed
This guide is part from my Bob The Robot Project, you can read more about it here.
Participated in the
Robotics Contest 2016