just making

Menu

Bus Pirate Test – BlinkM

Just received a Bus Pirate from Coolcomponents.co.uk, its the Sparkfun Bus Pirate with their ribbon cable and not the Seeedstudio (Dangerous Prototypes) so be prepared to reverse the order of the colour pin outs. This was my first point of confusion in that the Firmware menu nicely identifies the pin outs for the colour ribbon cable but these are back to front on the Sparkfun device and ribbon cable.

Don’t follow the output from the v command above for colour alignment, the below chart is for the ribbon cable for the Sparkfun Bus Pirate so GND is not Brown it is Black(which is bleeding obvious for normal conventions). Work your way across from black for the Voltage values i.e. it should really be 1.(Blk) 2.(WT) 3.(GR) etc..

The Blinkm uses I2C as a communications protocol so we need to use the black and white wires on the PWR -(GND) and +(3v) pins and the yellow and orange wires on the c(CLK) and d(MOSI) pins. In addition you need to have voltage applied to the pull up resistors (VPU) which is the blue wire. The Sparkfun ribbon doesn’t come with probes so I borrowed one from my Saleae Logic Analyser http://www.saleae.com/logic/ .

I2C is an open-collector bus, it requires pull-up resistors to hold the clock and data lines high and create the data ‘1’. I2C parts don’t output high, they only pull low, without pull-up resistors there can never be a ‘1’.
So to get the pullup resistors to high issue a capital ‘P’.I2C>PPull-up resistors ON
To save time you can issue a ‘WP’ to turn on the power and raise the pull up resistor.I2C>PWYou should now have the power on and the pull up resistors on, to check this issue an ‘i’ again.

Notice that the voltages have changed on the pins and that power and pull-ups is ON.
Here is where I’m going to help you cheat a bit, normally we would run a macro I2C>(1) or enter (1) at the prompt, this sniffs the available addresses for you but for now lets get straight to issuing a few commands against the Blinkm.

The default Blinkm script is still running so we need to stop it.
[0x00 “o”] stop the running script on the Blinkm

The Blinkm default script should now be off and the led will be lit at the colour the script happened to be in when we issued the stop command. In the image below I stopped it when it was in the off cycle.

The Blinkm address is 7-bit plus one bit for R/W. Blinkm 0x09 is 0x12 for writing and 0x13 for reading.

I am using an Arduino UNO so SDA (data line) is on analog input pin 4, and SCL (clock line) is on analog input pin 5.
There are both 7- and 8-bit versions of I2C addresses. 7 bits identify the device, and the eighth bit determines if it’s being written to or read from. The Wire library uses 7 bit addresses throughout and so does the Blinkm so for an Arduino sketch we can use 0x09.