Dunk's bot

home‎ > ‎

Electronics

Overview

Rather than create one big circuit board i will create separate boards for each task. This way i can replace a module easily as i learn and improve my design. I will also be able to use the same modules in future projects helping keep down design time of future robots.

The various modules are to be controlled by a master node over an i2c bus.
The master module will be connected to both the i2c bus and to the main CPU via USB.

I designed a simple, easy to debug communication protocol for passing information between UARTs on modules and the i2c bus. I documented it for a standard module project which was discussed on the Society of Robots forum. The communication protocol document is here: http://docs.google.com/Doc?docid=ddp2r5j8_21dgt72qgz&hl=en.

Although a standard module size and layout was discussed and decided on as part of the same SOR project i had already built most of the boards in the robot so while the firmware conforms to the doc, the hardware does not conform.

The main modules created are as follows:

  • Master i2c module.
  • Motor controllers.
  • Servo controller.

Master i2c module

This module handles the communication between the i2c bus and the USB interface on the main CPU as well as controlling the power management.

The USB interface will allow the robot to appear as a virtual serial port when connected to any computer. Simply type text commands into any terminal emulation program (such as minicom or hyperterminal).

This makes for easy testing of the chassis with installed electronics as i can simply plug it into my laptops USB port and issue commands from there.

An Atmel AVR ATmega8 is the controlling microcontroller on this module. The mega8 is connected to the i2c bus using it's built in i2c hardware. 

The USB device interface is made by connecting the ATmega8s UART to a FTDI FT232R USB to UART IC. I mounted this on a separate daughter board.

The LM2596-5 switching voltage regulators can be switched on and off by the ATmega8. One regulator is for powering this module. Obviously switching it off will power down the module. The other is for a power bus for the other modules. Powering down this regulator will power down any modules connected to the power bus.

The firmware for the ATmega8 in this module is practically the same as the firmware in my example Module Project Template documented on the Society of Robots website.

Obviously a unique i2c address would have to be given and code to enable the voltage regulator ICs and other IO pins but otherwise the firmware posted under the Module Project Template will work.

I might post the modified firmware if i ever get round to it.

Motor controllers

There are 4 of these i2c devices: one for each motor.

An AtmelATtiny45 microcontroller controls an LMD18200 motor controller chip.

The LMD18200 current sense pin is fed back to an analog input on the ATtiny45 allowing the motor current draw to be read. This is useful for detecting when the wheels have stalled.

The firmware for the ATtiny45 in this module is based on Atmel's i2c firmware example. I might post the firmware if i ever get round to it.


Servo controller

The ATmega8 based module is for controlling the camera pan and tilt servos as well as handling some other I/O.

For this module i am using my example Module Project Template documented on the Society of Robots website as it is with only slight modification to the firmware to allow one of the ATmega8's timers to drive 2 servos directly using the built in PWM on the mega8.

I have replaced LED[2-5] with lasers for my ranging system. (more on this later)

It's probably not the greatest idea to power the servos directly from the same 5V power bus as the microcontrollers on the modules but it seems to be working fine this way so far.

I might post the modified firmware if i ever get round to it.

Making the circuit boards

I use the toner transfer method of making circuit boards.

It's a bit tricky to get the hang of but gives reasonable results once you do.

Testing

So once the Master i2c module is connected via the i2c bus to the other modules and to a computers USB port via it's USB connection it appears on that computer as a virtual serial port.

You can then control the chassis from your favorite terminal emulation software (hyperterminal, minicom, whatever).








mrdunk(at)gmail.com

Comments