Sunday, 12 June 2011

Useful sites

http://www.bitsbox.co.uk/sensors.html
http://techcobweb.wordpress.com/2009/09/02/slot-car-challenge/
http://blog.thiseldo.co.uk/?p=383
http://dandr.org/2010/02/arduino-scalextric-lap-counter/

Sunday, 15 May 2011

The Kitchen-Table Industrialists

Nice piece about makers in the NYT, talks about OmniCorp, Adafruit and littlebits:

New York Times article

Omnicorp: working on Arduino Lasertag badges

Monday, 4 April 2011

Sunday, 27 March 2011

TI Series 2000 transponder reader

I just got the transponder reader working on a Sparkfun breadboard. The microreader takes about 100mA, and with an LCD shield the USB supply is struggling a bit. With an external PSU it's fine, though.

The microreader is wired in permanent read mode, which means the built-in serial ports will not be able to accept programming commands from the PC. To combat this, the microreader data is input on Pin 3 of the Arduino using NewSoftSerial.

The LCD shield is from eBay, from eKitsZone in Hong Kong. The shield was £12.50, as was the Duemilanove from the same source.

Here's the breadboarded circuit from the underside:

















The code below works fine. The bit that identifies the transponders is crude, due to the limited selection of tags I have. But this is only a proof of concept, so there's no real problem. PCB shield to follow.

TI page on MicroReader: http://www.ti.com/rfid/shtml/prod-readers-RI-STU-MRD1.shtml

Here's the code. Blogger has removed all the indents, but Arduino's auto format function will repair that.

/*

Serial test program 3 - works with TI Series 2000 reader

This version uses the newsoftserial library as the native serial port is disrupted by
the reader's constant output.

*/
#include // upgraded serial library
#include // library for LCD

int inByte = 0; // incoming serial byte
int iMsgPtr = 0; // position in reader message
boolean bMsgOn = false; // true when message being processed
boolean bNextID = false; // indicates next byte IDs the transponder (utter bodge!)
NewSoftSerial tiReader(3,2); // define pin 3 as RX, 2 as TX
LCD4Bit_mod lcd = LCD4Bit_mod(2); // define LCD, 2 line display

void setup()
{
// start serial port for input from TI reader at 9600 bps:
tiReader.begin(9600);
// start serial port fordebug output to PC serial monitor at 9600 bps:
Serial.begin(9600);
// initialise the display, clear it and put up a message
lcd.init();
lcd.clear();
lcd.printIn("Transponder ID");
}

void loop()
{
if (tiReader.available() > 0)
{
// get incoming byte from serial port:
inByte = tiReader.read();
// if start of message byte detected declare new message
if ((inByte==1) && (bMsgOn == false))
{
bMsgOn = true; // message being processed
iMsgPtr = -1; // initialise message pointer
}
else
// if processing a message...
if (bMsgOn == true)
{
// if this is the message length byte
if (iMsgPtr == -1)
{
iMsgPtr = inByte + 1; // add a byte to accommodate the error check
bNextID = true; // next btye is start of transponder ID
}
else
{
// decrement message pointer, check for end of message
iMsgPtr--;
if (iMsgPtr == 0)
{
// end of message
bMsgOn = false;
}
// This is the bodged bit. All the tags we have use different first bytes, allowing them to
// be ID'd straight away. The code should really build up an 8-byte ID, checking when complete.
if (bNextID = true)
{
bNextID = false;
switch (inByte){
case 0x61: outputData("Keyring 1");
break;
case 0x63: outputData("Trainer tag");
break;
case 0xCD: outputData("Stick");
break;
case 0xE4: outputData("Keyring 2");
break;
case 0xF5: outputData("Disc");
break;
}
}
}
}
}
}

void outputData(char value[])
{
// output data to LCD, copying to the PC serial for debugging
Serial.println(value);
lcd.cursorTo(2, 0); //line=2, x=0
lcd.printIn(" ");
lcd.cursorTo(2, 0); //line=2, x=0
lcd.printIn(value);
}

Sunday, 20 March 2011

Starting out with Serial

It looks like NewSoftSerial is the way to go: http://arduiniana.org/libraries/newsoftserial/

For programming Atmegas without the bootloader, here's an article on using PL-2303 instead of FTDI: http://www.uchobby.com/index.php/2009/10/04/diy-usb-to-serial-cable-for-3/

The Arduino will happily stuff data out to the serial port, next I need to get it receive data.

Arduino print info: http://www.arduino.cc/en/Serial/Print

Good code example and comments on DIYDrones: http://diydrones.com/forum/topics/razor-9dof-gps-arduino

Thursday, 17 March 2011