I'd Rather Be Building Robots

March 26, 2009

Released: RobotC Driver Suite beta1

Filed under: RobotC Drivers, Sensors — Xander @ 23:26

After many weeks of writing and testing, I’m ready to release my first suite of RobotC drivers for quite a number of devices and sensors.  I’ve tried to make sure that every API call was documented and (almost) all drivers have an example program to demonstrate how to use the driver.  The documentation was created using Doxygen.

The drivers make use of a standard header file that does most of the heavy I2C lifting, this allows me to keep the drivers small and make writing drivers for new devices very easy.  RobotC already has built-in drivers for some of the devices, the idea was to provide more control over when they are polled, at what bus speed and more importantly allow access to the less frequently used functionality of these sensors.

The suite includes drivers for the following devices:
- HiTechnic EOPD sensor (allows sensitivity of sensor to be set)
- HiTechnic Accelerometer sensor
- HiTechnic Gyroscopic sensor (including calibration functions)
- HiTechnic Compass (including recalibration functions)
- HiTechnic Color sensor (including recalibration functions)
- HiTechnic IR Seeker (allows access to individual IR sensors)
- HiTechnic IR Link (allows control over PF motors, both ComboDirect and ComboPWM mode)
- HiTechnic Touch MUX sensor
- HiTechnic ProtoBoard
- Mindsensors NXT Vision Subsystem (can detect colliding blobs and merge them)
- MAXIM MAX127 8 channel 12 bit AD converter
- MAXIM MCP23008 8 channel IO expander

A big thanks to HiTechnic for providing me with the sensors to write the drivers for.

You can download the source code here: [LINK].  The documentation can be viewed here: [LINK].  Please note that all the documentation is included with the driver’s zip file, so you can view it offline, too.

I hope you enjoy using them as much as I enjoyed writing them!

March 2, 2009

Sharp IR MUX board

Filed under: Experiments, Sensors — Xander @ 12:14

imageWhat is nicer than attaching a Sharp IR sensor to your NXT?  Attaching 8 of them, of course. That is what my friend Helmut wanted to do with his NXT.  Unfortunately, as good a programmer as he might be, messing around with electronics just wasn’t his “Tasse Tee” (that is cup of tea for you non-German speaking folks).

8 Sharp IR sensors consume a lot of power, much more than the NXT could ever hope to supply without frying.  A single sensor can easily draw up to 40mA, so 8 of them is 320mA, almost 4 times as much as the all the sensor ports can supply, put together!  An external power supply would be necessary.  A way to enable and disable sensors on an individual bases would be very useful, too.

Click to see a MUCH larger version Thus was born “MightyBoard”.  At the heart of the board are 2 ICs, the MAX127, an 8 channel 12bit ADC, and an MCP23008, an 8 channel IO chip.  Both these chips can talk I2C and are therefore ideal to connect to the NXT.  The ULN2803A merely acts as a buffer for the MCP23008. I added some green LEDs so that it was easy to see when a channel was enabled.

I prototyped the whole thing on 3 breadboards but to cut down on the wires and mess, I only made it work for 4 channels.  It was for proving a concept, rather than duplicating the whole thing.  Below is a short video of one of the first tests.

Next was the hard part, making a permanent copy of the whole thing.  I chose to use copper strip board, the 3 hole per strip kind.  They’re fairly easy to use and you almost never have to manually cut any of the strips.  I used a cut up conducting flat strip of Lego as a connecting point for the Lego battery holder. I soldered some pins into the back of it and then super glued it to the board to stop it from ever moving again.  The small dual DIP switch is to allow the pull-up resistors to be disabled.  This is necessary if the second sensor looped through is a Lego sensor.  They have the pull-ups already built in.

 Front of the board, nice and tidy Back of the board - spaghetti hell

To prevent the mess of wires from being ripped off, I used a whole bunch of hot glue and the plastic from a DVD cover box.  It really did the trick and made the board rather “professional” looking, even if I do say so myself.  I used a box cutting knife to trim the blobs off the side.

Lots of hot glue. Nice and flat back, no spaghetti!

Below is the video of the first test I did with the final version of the MightyBoard.  As you can see, it worked rather well.

 
The parts list can be found below.  Please note that this is merely for the control circuit and does not include parts needed to make the power supply.  I am sure a much more efficient design could be made.  In my circuit I used the rather pricey L4805 which has a super low drop-out voltage.  I also used a rectifier to ensure that the circuit could not be damaged in the event of the power supply being wrongly connected.

MAX127 8 channel 12 bit ADC with I2C interface
ULN2803A Darlington transistor array
MCP23008 8-Bit I/O Expander with I2C interface
C1..C8 0.1 uF capacitor
R1..R8 1kOhm resistor
D1..D8 green 3mm LED
CON0..CON8 3 pin connector
C9 0.01 uF capacitor
C10 4.7 uF capacitor
J1, J2 NXT connector           
R1..R8 1kOhm resistor 
R9, R10 82kOhm resistor   
SW1  double DIP switch

You can download the latest version of the RobotC drivers for this board here: [LINK].

Have fun and remember, if you blow it up, don’t blame me!

Blog at WordPress.com.