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.

Parts

  1. Common cathode RGB Led (Check here or here or anywhere you like)
  2. 3x330R resistor
  3. Breadboard or a perfboard
  4. Usb micro cable
  5. RestIO Model O module (Check here)
  6. A pc with usb ports and networking

Step 2: Prototype the Circuit

  1. Place RestIO module as on breadboard as you like.
  2. It's nice to have red, green, blue and black jumper cables to keep things tidy and simple.
  3. Make sure the module is not connected to any usb port.
  4. Connect modules VSS to Leds common cathode which is the longest pin. (Optionally with the black jumper cable)
  5. 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)
  6. Connect the third pin on led to modules port C1 over an 330R resistor.(Optionally using the green jumper cable)
  7. 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

  1. Connect Restio module to usb.
  2. Run Restio server application.
  3. Open your browser and go to http://localhost:8080/www/
  4. Toggle ports C0,C1 and C2 making sure you can control each color.

Step 4: Add More Software

  1. Download the attached directory which contains a custom RGB led control application.
  2. Extract and copy the rgbDemo folder to www under RestIO servers installation directory.
  3. Open your browser and go to http://localhost:8080/www/rgbDemo/index.html
  4. 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

  1. You can use more leds and more modules for fancier designs.
  2. You can pretty much use any programming language to control RGB leds or other devices over rest services. See RestIO documentation for more.
  3. Feel free to comment and ask about suggestions and ideas.