Arduino IR Libraries
This one offers multitasked IR transmission without any delays during the interrupt; this might be more useful when we want to combine transmitting and receiving in a single robot.
Arduino support for the BrushBotComm board
Thanks to the work done by René Bohne with the LumiNet project team and others on the LumiNet thread of the Arduino forums, the Arduino IDE version 18 contains the necessary hooks to support Atmel tiny series chips. A couple more elements are still needed though — a new core for a tiny44 based board, and a new entry to the boards.txt file. The core is the under-the-hood set of files that gets wrapped around the user code during compilation, and the boards.txt file is what ties the core into the IDE and controls which boards show up in the Arduino Tools->Board menu. Follow the instructions below to add these elements and start programming.
To get up and running:
- Install Arduino 18 or later
- Unzip the following file into your default sketchbook directory. This directory can be found by starting the Arduino IDE and looking in the Preferences for the “Sketchbook location”. (OSX: ~/Documents/Arduino)
arduino_brushBot_v0.3.zip OR arduino_brushBot_v0.3.tar.gz
This zip (or tar.gz) file will create a directory for BrushBotComm sketches and add a few simple example sketches, and will create a hardware/partsSwarm directory containing the new cores.
- If the Arduino IDE is open, close it and restart it.
You should see some new entries in Tools->Boards
- Open the BrushBotComm/Blink_BrushBot sketch
- Select one of the BrushBotComm boards from the Tools-Boards list (which one is not important for compiling/verifying code.)
- Compile the code (Verify button). There should not be any warnings or errors.
- Connect the BrushBotComm board via an ISP programmer.
It is necessary to use an ISP programmer rather than just a straight serial cable to download new code because we don’t have a tiny44 bootloader, and even if we did, it would take up precious flash space — we only have 4k in this chip, which isn’t that much.
In the Tools->Boards menu, you’ll notice a few different versions of BrushBotComm. These are to support different flavors of ISP cables:
- BrushBotComm w/ arduinoISP — use this if you’ve turned an Arudino board into a ISP programmer by loading the ArduinoISP example sketch (included in version 18) onto it. See here for instructions on using a Teensy2.0 as a BrushBotComm programmer.
- BrushBotComm w/ AVRISP V2 — use this if you’re using an older serial based AVRISP programmer
- BrushBotComm w/ AVRISP MkII — use this if you’re using a newer USB based AVRISP MkII programmer
Select the option appropriate to your ISP cable.
- Program the fuse-bits if this is a brand new board.
Do this with the “Tools->Burn Bootloader” menu. The way things have been setup for the BrushBotComm board, this won’t actually burn a bootloader — it will just burn the fuse bits. At the moment, this step causes a Java error, but if you scroll up in the console, you should see that the fuse bits were programmed successfully.
Currently the only fuse bit changed from default is the CKDIV8 fuse to up the internal clock rate from the default 1MHz to 8MHz.
- Upload the code (Upload button). If all goes well, the green and red LEDs should blink in opposition every half-second.
//Arduino : AVR pin (dir) : #define : Function // D0 : PB0 (out) : RED_LED : Red Led (D3) // D1 : PB1 (out) : GREEN_LED : Green Led (D4) // D2 : PB2 (out) : MOTA : MotA // D3 : PA7 (out) : MOTB : MotB // D4 : PA6 (out) : REAR_IR_TX : Rear IR LED (D2) / ISP MOSI // D5 : PA5 (out) : FRONT_IR_TX : Front IR LED (D1) / ISP MISO // D6 : PA4 (in ) : : ISP SCK // D7 : PA3 (in ) : IR_RX : IR Receiver (U2) // D8 : PA2 (bi ) : : NC // D9 : PA1 (in ) : : Battery sense // : PB3 (in ) : : Reset // : PA0 (bi ) : : NC (AREF)
NOTE: #defines are defined in brushbot.h, which is automatically included in the main sketch. If you create sub-sketches, add #include “brushbot.h” at the top of each subsketch.
Blink_BrushBot — simple program to alternatively blink the red and green LEDs every half-second. (Included in the Arduino BrushBotComm distribution above.)
IRRxTest — experimental code to get the IR Rx working. Recognizes Sony remote control commands 11 (enter) and 21 (power). (Included in the Arduino BrushBotComm distribution above.)
IRTxTest — experimental code to get the IR Tx working. Repeatedly send Sony remote control command 11 (enter). (Included in the Arduino BrushBotComm distribution above.)