Introduction: Restful RGB Led
This instructable controls an RGB led via rest services,pc and a usb port using a simple usb io module.
How Does It Work
- Restio server (software supplied with the usb io module) runs on a pc with a usb port. This application serves restful web services.
- Restio usb module is connected to pc via usb.
- An rgb led is connected to Restio module.
- A client (mobile device or controlling pc itself or any device that can run a browser and can access controlling pc) sends control messages to controlling pc.
- Restio server responds to these messages and forwards a lower level representation via usb to io module
- IO module turns its ports on and off controlling RGB led.
Step 1: Parts and Skills
To complete this instructable you need some skills
- General computing skills, basic programming skills.
- Basic understanding of what web services are and how they work as well as networking.
- Basic understanding of electrics and electronics.
Step 2: Prototype the Circuit
- Place RestIO module as on breadboard as you like.
- It's nice to have red, green, blue and black jumper cables to keep things tidy and simple.
- Make sure the module is not connected to any usb port.
- Connect modules VSS to Leds common cathode which is the longest pin. (Optionally with the black jumper cable)
- The longest pin common cathode being the second pin, connect the first one to modules port C0 over an 330R resistor.(Optionally using the red jumper cable)
- Connect the third pin on led to modules port C1 over an 330R resistor.(Optionally using the green jumper cable)
- Connect the fourth pin on led to modules port C2 over an 330R resistor. (Optionally using the blue jumper cable)
You can fiddle with the resistor values as long as you are sure that no individual led withdraws more than 25mA s of current. Based on the rgb led you choose intensities of colors and led forward voltage usually differ.
Step 3: Test the Circuit
- Connect Restio module to usb.
- Run Restio server application.
- Open your browser and go to http://localhost:8080/www/
- Toggle ports C0,C1 and C2 making sure you can control each color.
Step 4: Add More Software
- Download the attached directory which contains a custom RGB led control application.
- Extract and copy the rgbDemo folder to www under RestIO servers installation directory.
- Open your browser and go to http://localhost:8080/www/rgbDemo/index.html
- This application uses Bootstrap and AngularJS. So if you are familiar with or want to try Angular and rest services feel free to improve and ask about it.
Step 5: Explore Clients and Have Fun
- You can use more leds and more modules for fancier designs.
- You can pretty much use any programming language to control RGB leds or other devices over rest services. See RestIO documentation for more.
- Feel free to comment and ask about suggestions and ideas.
We have a be nice policy.
Please be positive and constructive.