Migrating to the 1284P
For the next steps in the neural network project, I'm upgrading the microcontroller from an Atmel ATMEGA328P (Arduino Uno) to an ATMEGA1284P. Although no "official" Arduino boards use the 1284P, unofficial Arduino boards files are available for the chip and it's a pretty simple matter to download them from GitHub here and add them to the IDE. You can also download the files from the developer's blog here where there is a fairly comprehensive write-up of the chip and the process of getting it going.
As an Arduino compatible controller the 1284P is not-too-shabby. It's available in a hobbyist and breadboard-friendly 40-pin PDIP package. The process of assembling your own circuit is essentially identical to the 328P - you can use the same 16Mhz clock crystal and 5V power regulator, just mind the pinout. In addition to the extra input/output, the 1284P sports 128K of flash memory for programs (4x the Uno) and 16K SRAM for variables and data (8x the Uno). The 16K SRAM is absolutely key here, because the neural network is a RAM hog. The 2K on the UNO was barely enough to run a demo, with nothing left over for an actual application.
A word of caution on the 1284P. There is a pesky hardware bug that affects serial comms on UART0, making communications on that port impossible and spontaneously resetting the controller when you try. The UART flaw is especially insidious because it appears to be inconsistent. It is more severe on some chips than on others, and on some it does not appear to be a factor at all. It's even possible that Atmel has fixed the problem on the later production runs but to my knowledge this is not confirmed. There is also a software fix which requires changing the low fuse setting in the boards file from 0xFF to 0xF7, which I tried but saw only partial improvement.
In general, once this flaw is known and understood, it's not such a big deal. The 1284P has three UARTs and in most cases the workaround is simply to avoid UART0. However, the bootloader provided at the above GitHub repository assumes UART0, and unless you have the chops to go in and rewrite the bootloader there is no easy workaround for that! If you're unlucky enough to have one of the troubled chips, you're probably not going to be able to get the bootloader going.
In the end I abandoned trying to use the bootloader and just load programs through the JTAG pins using the UNO I keep setup as an ISP programmer. (If you have the hardware you need to burn a bootloader, then you have the hardware you need to program without a bootloader.) It's a minor pain, especially since I'm also using serial comms to retrieve data from the 1284P, but for the moment the benefits far outweigh the inconvenience.
Otherwise, so far the migration to the 1284P has been surprisingly smooth with all of the various pin mappings and functionality working without issue. I've got two PWM outputs and four digital outputs going to the motor controller, another three digital outputs and three analog inputs for the IR sensors, and two digital inputs for the bumper switches. I'm also reading and writing to an I2C EEPROM and can send and receive over UART1.
October 7, 2013
Buster - A Voice Controlled Raspberry Pi Robot Arm
Buster is a fully voice interactive robot arm built around the Raspberry Pi. He acts upon commands given in spoken English and answers questions too.
Haar LBP and HOG - Experiments in OpenCV Object Detection
Back to Basics
I've spent some time lately coming up-to-speed and playing with OpenCV - especially the object detection routines. Three that caught my eye for further investigation were Haar Cascades, Local Binary Patterns (LBP), and Histogram of Oriented Gradients (HOG).
After spending quite a while exploring various approaches to walking robots and other mechanical conundrums, I'm turning my attention to machine learning and building a simple but robust platform to experiment with neural networks.
Getting Up and Running With a Tamiya Twin-Motor Gearbox
Tamiya makes a full line of small gearbox kits for different applications that are capable for their size and an easy, economical way to get a small to medium size wheeled robot project up and running.
Raspberry Pi to Arduino SPI Communication
This tutorial presents a basic framework for Raspberry Pi to Arduino communication and control using SPI - the Serial Peripheral Interface bus. Explores SPI in some detail, discusses hardware and software considerations, and develops a working example of a bi-directional communications scheme that could be adapted for any number of command and control applications.
An Arduino Neural Network
An artificial neural network developed on an Arduino Uno. Includes tutorial and source code.
A Simple Machine Learning Experiment for the Artificial Neural Network
A very simple concept for getting started applying the network to a robot machine learning scenario. The test robot has three IR sensors and two bump switches. For the experiment, the robot will use the bump switches to register collisions, and based on those collisions will learn to avoid obstacles in the future.
Flexinol and other Nitinol Muscle Wires
With its unique ability to contract on demand, Muscle Wire (or more generically, shape memory actuator wire) presents many intriguing possibilities for robotics. Nitinol actuator wires are able to contract with significant force, and can be useful in many applications where a servo motor or solenoid might be considered.
Precision Flexinol Position Control Using Arduino
An approach to precision control of Flexinol contraction based on controlling the voltage in the circuit. In addition, taking advantage of the fact that the resistance of Flexinol drops predictably as it contracts, the mechanism described here uses the wire itself as a sensor in a feedback control loop.
LaunchPad MSP430 Assembly Language Tutorial
One of my more widely read tutorials. Uses the Texas Instruments LaunchPad with its included MSP430G2231 processor to introduce MSP430 assembly language programming.
K'nexabeast - A Theo Jansen Style Octopod Robot
K'nexabeast is an octopod robot built with K'nex. The electronics are built around a PICAXE microcontroller and it uses a leg structure inspired by Theo Jansen's innovative Strandbeests.