Show Posts
Pages: 1 [2]
16  Forum 2005-2010 (read only) / Interfacing / Re: Add 15 extra Digital I/O pins with one I2C device on: January 14, 2009, 10:55:54 am
I don't know if it was because it was built with Arduino in mind, but the BlinkM smart-led units (of which I have 4) work fine without having to shift the addresses...
17  Forum 2005-2010 (read only) / Interfacing / Re: Add 15 extra Digital I/O pins with one I2C device on: January 14, 2009, 10:25:57 am
After some troubleshooting, I've found that the manual and the website present all the default ID codes as 8-bit, and they say you can only use even numbers... In Arduino the addressing is using the 7 main bits, essentially doing the same thing but when addressing them you have to shift the addresses left one bit when using them in 8-bit format.
In the manual it says the default address is 0x42, which is actually 0x21 in the 7-bit mode that "Wire.h" uses.

I'm posting the code I use to talk to the BV4206, as I think it might be useful for other newbies like myself, as it took me a few hours to figure this lot out from scratch.
This code basically just changes the default address and flashes the d0 pin on the chip (not on the Arduino).

Code:
#include "Wire.h"

void setup() {
    delay(100);
    Wire.begin();                  // set up I2C
    
    /** For BV4206 GPIO Devices **/
    //change address from default (0x21) to 0x10
    Wire.beginTransmission(0x21);  // join I2C, talk to BV4206 by id
    Wire.send(0x99);   //change address command
    Wire.send(0x10 << 1);  //new address (7 bit)
    Wire.send(0x55);  //check code - do not change
    Wire.send(0xaa);  //double check code - do not change
    Wire.send(0x21 << 1);  //current address (7 bit)
    Wire.endTransmission();      // leave I2C bus

    //set pin 0 to output mode
    Wire.beginTransmission(0x10);  // join I2C, talk to BV4206 by id
    Wire.send(0x01);   //set pin mode command
    Wire.send(0x00);  //the digital output id
    Wire.send(0x00);  //0x00=output 0x01=input
    Wire.endTransmission();      // leave I2C bus
    delay(100);
}

void loop() {
    //set output 0 high
    Wire.beginTransmission(0x10);  // join I2C, talk to BV4206 by id
    Wire.send(0x02);   //set output command
    Wire.send(0x00);  //the digital output id
    Wire.send(0x01);  //0x01=hi 0x00=low
    Wire.endTransmission();      // leave I2C bus
    delay(100);
    
    //set output 0 low
    Wire.beginTransmission(0x10);  // join I2C, talk to BV4206 by id
    Wire.send(0x02);   //set output command
    Wire.send(0x00);  //the digital output id
    Wire.send(0x00);  //0x01=hi 0x00=low
    Wire.endTransmission();      // leave I2C bus
    delay(100);
}
18  Forum 2005-2010 (read only) / Interfacing / Add 15 extra Digital I/O pins with one I2C device on: January 11, 2009, 06:19:04 am
I found this item on eBay and immediately bought 4 of them.

And because you can have more than 100 I2C devices on the same bus, you could theoretically control upto 1500 digital input/output devices.. if you could afford that many...
There's also one pin with PWM functionality, and this description by no means covers all of it's functions, so check it out.

http://www.byvac.co.uk/bv/bv4206.htm

Also as mentioned in a previous post, you can get small boards from the same place that control LCD modules through I2C.
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1220386069
19  Forum 2005-2010 (read only) / Interfacing / Re: Erratic values piezofilm sensor on: January 11, 2009, 06:28:35 am
Try adding a small capacitor (metal film or polyester) between ground and the output of the sensor. This might smooth the output enough for you to get a steady reading.

If the capacitor is too large however it might 'slur' the responses and might reduce the accuracy, and spikes in the output feed probably won't be recognised at all.
20  Forum 2005-2010 (read only) / Interfacing / Re: nuelectronics Arduino Ethernet Shield HTTP Client on: January 11, 2009, 06:56:31 am
Ok try adding code at various intervals throughout the client connect script that prints something to the LCD, so you can see how far the script actually is progressing..
Or print back to the USB connection as a status indicator.
Keep in mind it could be something as simple as a typo that's stopping the whole script executing..

21  Forum 2005-2010 (read only) / Interfacing / Re: nuelectronics Arduino Ethernet Shield HTTP Client on: January 11, 2009, 06:22:53 am
I don't think you can receive ping responses unless you program the arduino to recognise Ping requests and respond to them. You'd be better off first making sure that you can output to the LCD, and then see if you can connect to a VERY simple web server and download a text file and analyse that.
It would be a good idea to try and download a text file from a webserver first that just contains a 1 or a 0, which should turn on or off pin13 (the onboard LED) respectively.
Pages: 1 [2]