Are there any computer-programmable lights out there?

wyager

Flashlight Enthusiast
Joined
Feb 10, 2010
Messages
1,114
I think AVR's are easier to program just because they tend to have more memory (program and ram) than the smaller pic's, so you don't have to code as tightly. Plus you can compile for them with gcc, there is the whole Arduino dev environment, etc. Bluetooth-serial converters seem to be crazy big and expensive. I was thinking of an using FTDI chip and one of those cheap tiny USB bluetooth dongles.
I'm not gonna get into the AVR/PIC argument (even though I agree with you :)), but unfortunately your bluetooth+ftdi thing would not work for two reasons. 1:bluetooth dongles and ftdi are both USB slaves. They can't talk to each other. 2:the conversion from USB->serial is not as simple as you think. If you treated the bluetooth dongle like a serial device you would get nothing but gibberish. You would have to get a dedicated serial bluetooth or nothing would work. You could, however, use bootloader-based USB on an ATTiny, but this is very complex and requires some stuff that looks pretty tricky to me. I haven't tried yet, but it might take a while to figure out.

I am not using the hardware USI on the Tiny85 for the serial it's software serial. The code is based off Amtel aplication note and works well enough for just reciving a single byte level. The Helmet mount version is more complex as I need rx and tx to talk to the Ant+ radio chip so I have had to modify the board and the fuse programing to enable me to use the reset pin. I have it setup with a very nice little serial bootloader I found so I can still reprogram it.

The bike compute is based around an xmega128A1 board with a micro sd slot and serial to usb chip on it. I then have a host of other peripherals attached eg gps, barometer, 2 * i2c graphical lcd, rtc, etc.

There is a tutorial about bluetooth controll form a mobile handset for a light here. I have used the basic linear driver design in some of my smaller lights. I coded it in C rather than assembeler though as there is no need for assembeler with an 8k tiny.

Very cool. It seems you've worked pretty hard on this! I'll check out that mobile phone controlled light thread.
 

paulr

Flashaholic
Joined
Mar 29, 2003
Messages
10,832
Wyager, thanks for the bluetooth/ftdi info, and those bluetooth and uC threads linked above look awesome; I hadn't seen them before. I'll ask some of the avr hackers I know what to do about the bluetooth situation. I don't understand why there's no butt-simple, cheap bluetooth interface since the whole point of bluetooth was to be exactly that, so it's found in 5 dollar wireless earpieces and all that sort of thing. It may actually be cheaper to use wifi than one of those bt serial dongles. Then I could put a web server in the avr and run the light directly from a browser on my laptop :eek:.
 

wyager

Flashlight Enthusiast
Joined
Feb 10, 2010
Messages
1,114
Wyager, thanks for the bluetooth/ftdi info, and those bluetooth and uC threads linked above look awesome; I hadn't seen them before. I'll ask some of the avr hackers I know what to do about the bluetooth situation. I don't understand why there's no butt-simple, cheap bluetooth interface since the whole point of bluetooth was to be exactly that, so it's found in 5 dollar wireless earpieces and all that sort of thing. It may actually be cheaper to use wifi than one of those bt serial dongles. Then I could put a web server in the avr and run the light directly from a browser on my laptop :eek:.
I think bluetooth started out very simple, then they kept stacking on protocols and security until it got pretty tricky. And my guess is there are some very cheap options for bluetooth, but most likely they are SMD, require bulk ordering, and have no user support. Now that I think about it, I think your best bet is to emulate USB on the avr. Check out http://www.obdev.at/products/vusb/index.html . The trick is figuring out the tricky USB interface between the PC and the dongle, but I'm sure someone else has done it. Good luck with it!
 

HKJ

Flashaholic
Joined
Mar 26, 2008
Messages
9,715
Location
Copenhagen, Denmark
I think the cheapest and easiest way to get a computer interface in a light is to use a I2C or SPI protocol and then make a cable with a USB to I2C/SPI chip in.
This does not require any advanced programming or development, some MPU's even has the communication hardware build in and does not require bit banging it.
 

paulr

Flashaholic
Joined
Mar 29, 2003
Messages
10,832
Wyager, thanks, that link looks pretty useful, but it says "USB device" which I think means the client side of USB. To use one of those bluetooth usb dongles I have to figure out how to support USB host.

HKJ, I think the smaller avr's don't have uarts, but bit banging seems fine for this. Alternatively, since it's a light, maybe I could just include a photodiode and do optical wireless. I like the idea of figuring out a cheap bluetooth scheme though, since it would let me make all kinds of other portable devices controllable from my phone. I -know- this cheap small stuff exists since there's tons of mass market consumer crap (bluetooth earpieces etc) using it. I'm just wondering why it hasn't filtered down to the hobbyist level.
 

HKJ

Flashaholic
Joined
Mar 26, 2008
Messages
9,715
Location
Copenhagen, Denmark
HKJ, I think the smaller avr's don't have uarts, but bit banging seems fine for this.

SPI/I2C does not require a UART and is much easier to do in software than ordinary serial communication. Another advantage of SPI/I2C is the timing, you do not need a precise timebase for it.

Only disadvantage is that you need a special cable with a chip in, but that would not use space or power in the flashlight.
 

wyager

Flashlight Enthusiast
Joined
Feb 10, 2010
Messages
1,114
Wyager, thanks, that link looks pretty useful, but it says "USB device" which I think means the client side of USB. To use one of those bluetooth usb dongles I have to figure out how to support USB host.
Oops, you're right. I was under the impression it had host support. Dang. And as for the I2C to bluetooth thing with a special cable and whatnot, it would be so much simpler just to get a UART based bluetooth device with an attiny2313 or similar...
 
Top