Wi-Fi RGB LED strip (120718)
Wouldn't it be nice, if you could put an RGB LED strip anywhere in your house? Wouldn't it be nice if you could control that RGB LED strip from behind your PC, smartphone or tablet? With the Wiznet WizFi220 hooked up to a webserver running on an ATmega328 or PIC18F14K50 you can!
Wouldn't it be nice, if you could put an RGB LED strip anywhere in your house? Of course, modules like that already exist, and they change colors automatically.
Wouldn't it be nice if you could control that RGB LED strip from behind your PC, smartphone or tablet?
Now, using the Wiznet WizFi220 hooked up to an ATmega328 working as a webserver we can!
PCB, bare, 120718-1
PIC18F14K50, programmed, 120718-41
Module, assembled and tested, 120718-91
Module WizFi220 Serial to WiFi Module (High TX Power), 130076-92
Keeping in mind that we need an entire webpage and I didn't really want to use an SD card for this, I decided to put the webpage in the progmem. It can be a big file, due to the use of sliders for color picking, but if you strip out the Jquery, it can fit into a smaller processor.
Update for 6-8-2012
I have added the schematics below.
For people who want to buy a LED strip I refer you to http://www.lnsoundwebshop.nl/c-645573/spaterwater-bestendige-strips/. Of course, you can always look at eBay, but I recommend this address.
Update for 7-8-2012
I finished the PC App for connecting the WIZnet module to a Wi-Fi network. Source and binaries have been added.
Update for 8-8-2012
Fixed some not so nice translating issues in the software.
I also commented a big part of the C code for the ATmega controller.
Migrated to a different (smaller) ATMmega. So the code had to be adjusted to that. Quick reminder: the current code does not work (yet).
The schematics have been updated as well for this change.
Update 12-9-2012
Up to the previous update, Koen, a trainee, worked on this project. He has left Elektor and I will continue this project. Corrected the circuit diagram to match it to the actual breadboard prototype.
Update 6-12-2012
I finally found the time to dive into the project. Rewrote the software so that I understand what is going on. Since Koen used an ATMega328 I ported the code to the Arduino Uno. When I have fully working Arduino code I will de-Arduino it. For the moment it only relies on the Arduino Serial port class and the analogWrite function. This is easy enough to replace by non-Arduino code.
Before Koen left he mentioned that he had problems with the Wizfi module closing ports on sockets or so all the time. He had come up with a javascript addition to JQuery to circumvent the problem. I have now discovered that the HTTP header he sent back after a GET request did not contain a “Connection: close” field. Adding this line seems to fix the problem so I can scrap the javascript hack.
Koen used GET to send RGB values, I want to use POST, which was meant for this kind of things.
I think I am almost there.
Update 7-12-2012
My prototype is working fine now, see photo below. It uses the POST command and sliders from JQueryUI. I don't like this too much, but don't see another option. The problem is that JQuery is too big to fit in the MCU so the PC has to fetch it himself from the internet.
The weird connection handling script has been deleted and the HTML code is pretty clean now. I've tested with Firefox, IE9, Android and iPad2. My Arduino code, including HEX file, is attached below. Note that since it is Arduino-based, the MCU must run from 16 MHz otherwise the serial port speed will be wrong.
I used the http://www.elektor-labs.com/9120502252 Wi-Fi shield to which I added a little board with three MOSFETs.
Usage:
Preconfigure the Wizfi220 module so that it can connect as a TCP server to your Wi-Fi network. Use a serial tool (Hyper Terminal or so) to do this. This is what I used (DHCP, you can do static IP too):
AT+WPAPSK=your-ssid,"your passphrase"
AT+NDHCP=1
AT+WAUTO=0,your-ssid
AT+NAUTO=1,1,,80
ATC=1
ATA
Wait for the module to connect. I chose DHCP, so do a AT+NSTAT=?
to get its IP address.
Now point your browser to the module's IP address and you should get a webpage with three sliders, a button and a color box. Color updates are send when you release a slider or click the button.
Update 17/01/2013
Although I have a working Arduino prototype, I decided to port the whole thing to a smaller MCU, especially smaller in size. Since I couldn't find a suitable AVR I decided to switch to the 20-pin PIC18F14K50 which happened to be lying on my desk. This MCU has USB inside and after a lot of porting effort I managed to fit a USB serial stack and the WiFi LED code in it. The goal now is to also be able to configure the WiFi module from the PC through the PIC. Koen wrote a PC configuration tool (in C#) that I would like to use without extra USB serial converter cables but it needs some reworking.
Limited time makes my progress slow, but I am getting there.
Update 21/02/2013
That's it, I am almost done. I designed a PCB for a small cheap ABS enclosure and I received the PCB this week. It is almost a perfect fit, I just have to move the USB connector slightly to the center. Also , I don't know how I managed to get it wrong, but I got it wrong, the Wifi status LEDs are not in the order I expected. Photos are below.
The board is working fine and can be used as either:
- a Wifi controlled RGB LED strip;
- a PIC18F14K50 rapid prototyping board with bootloader and USB and/or Wifi capabilities;
- a USB serial port, wireless if you want.
It has a on-board 5V and 3V3 power supply capable of delivering 1A total. Input voltage can be from 7 to 40V, or over USB. An extension pin header grants access to the unused MCU pins. The three output FETs (IRL540) are specified for up to 100V and can handle 20A easily. Every output can have a flyback diode so switching inductive loads like relays is also possible.
Update 10/10/2014
Finally added the Eagle files and PIC18F14K50 firmware. Sorry for the wait.
PCB, bare, 120718-1
PIC18F14K50, programmed, 120718-41
Module, assembled and tested, 120718-91
Module WizFi220 Serial to WiFi Module (High TX Power), 130076-92
Discussie (8 opmerking(en))