1-wire controlled RGB-led
This projects goal is to controll the color of a RGB-led from a computer. This can be done in a lot of ways, but as I have a 1-wire network I choose to use this. The cable can be long, the problem is that it makes things a bit complicated. It is possible to create code to let the Pic act as a 1-wire slave, but that is hard and violates the 1-wire license. My solution is instead to use a DS2405 1-wire switch. It has an open collector output that is attached to a resistor to Vdd and to a pin och the Pic. The Pic is by the way a surface mounted 12F510. Three of the other pins on the Pic is connected to the RGB-led. The PC is using OWFS to mount the 1-wire devices, and is mounted at /mnt/owfs. By writing zeros and ones to /mnt/owfs/05.FF4421000000/PIO the output on the DS2405 shifts. The Pic polls this pin, and detects the change. If the transfer from 0 to 1 is fast, the Pic fetches a new value to it's PWM-loop from a look-up-table, which makes the color of the RGB-led change. If the computer instead waits a second between the writes the colorcounter in the Pic are reset. This way you can write a 0, wait a second, and write a 1. The colorcounter then resets (becomes 0). Then you write 0-1 a specified number of times to reach to the desired colors. As demonstration the computer runs a script that resets the counter, then counts through eight colors: Video on YouTube The device is then put in a glass jar with some plastic. From above: And from the back: Så en video som visar samma mjukvara som ovan, de olika färgerna gås igenom. Och nej, den svarta kontakten ska inte vara där, det är anslutningen till programmeraren som kommer att klippas bort när jag är helt säker på att jag är nöjd med programmet. Skakigt värre och med fokus på nått annat, men ändå :) One more video Looks nicer when it's darker in the room: 1-wire info