Making the Scary Monkey project with my son has been a lot of fun so I decided to make another project for the kids. I built an interactive RGB lamp. The lamp has no switch and no dimmer, it’s entirely controlled with radio frequency identification (RFID) tags. The RFID reader is hidden in the lamp body and the RFID tags are embedded in colored wooden disks.
You can change the color of the lamp by placing a colored disc into the circular recess in front of the lamp body. When no disc is placed in the receptacle, the lamp changes color randomly. Place the white disc to produce a white light and the black disk to turn off the lamp. You can also turn the lamp into a stroboscope or produce other special effects by combining different sequences of colors.
The body of the lamp and the RFID disks are made out of scrap wood I had in my shop. The shade is made from a transparent drawing tube and tracing paper.
There are many different ways this project can be built. The following list only includes the essentials electronic components required for the project.
- RGB LEDs strip
- 3 N-Channel Mosfet transistors
- RFID reader and tags.
- One 3mm or 5mm LED
- Arduino micro-controller.
- Piezo speaker (optional)
The circuit for this project has many uses:
- Drive the three color channels (RGB) of the LED strip
- Read data sent by the RFID reader
- Drive the “ready” LED
- Send tones to the piezo speaker if any
Since all this is controlled by an Arduino micro-controller, building the circuit as an Arduino shield would make it more compact and reusable. The arduino shield PCB design will be explained in the next section.
The RGB channels are driven by the Arduino pulse with modulation (PWM) output pins 3, 5 and 6. The three Arduino logic pins are connected to the gate of three N-Channel Mosfet transistors. You can control the intensity of each channel by writing values from 0 to 255 on any of these pins.
The RFID reader communicates with the Arduino micro-controller through a serial connection. I wanted to be able to re-program the lamp without having to disconnect the RFID reader so I decided to use the SoftwareSerial library. This library allows you to use the IO pin of your choice for serial communication, freeing the pins 0 & 1 for communication with the computer. I used pins 8 and 9 of the micro-controller to communicate with the RFID reader.
The power is provided by a 12v 600mA wall transformer. The 12v pin of the transformer is connected to the power wire of the LED strip and to the Vin pin of the Arduino.
I added a small LED to indicate when the RFID reader is ready to read a new tag. This LED is connected on pin 7 of the Arduino micro-controller. Finally, an optional piezo speaker can be attached to pin #10 of the Arduino bord to integrate sounds in the project. The “ready” LED and the piezo are optionals.
The Arduino Shield
This project was a perfect fit for a custom Arduino shield. I designed the shield using Fritzing, an open source application that allows you to build your circuit and PCB at the same time. The circuit has been designed as a single side PCB shield. You can find the Fritzing project on my Github repo at: https://github.com/pchretien/rgbrfid
I love woodworking and I love electronics so mixing both into a single project was pure fun. I used Stketchup to do draw the lamp and test the design. The plans are available on my Github account at https://github.com/pchretien/rgbrfid.
To build the body of the lamp I cut two pieces of 1/4″ plywood and four pieces of 3/4″ pine. To cut the shape of the lamp I printed a 1:1 template of the lamp using a TOP / Wire-frame view in Sketchup and glued it on top of the boards. To make sure the boards stayed aligned during cutting, I put some carpet tape between all pieces. (this trick from the best woodworking show on Youtube woodworkingformeremortals.com).
Once the shape of the lamp is cut, remove the two plywood boards and trace a line 3/4″ inside the outline of the lamp. Again, using the band-saw, cut the inside of the lamp. It’s now time to sand all the pieces and apply several coats of spay paint.
The six wooden disks are cut from a piece of 1/4″ plywood. Each disk is made gluing two 1/4″ disks together. Do not forget to place the RFID tags between the two pieces of plywood. I used a 1 1/2″ Fostner bit to make a shallow recess to fit the RFID tags. Sand and paint the disks with the colors of your choice.
Finally, I used a PVC pipe to hold the LED strip. I painted it white, cut a hole on top of the lamp and placed the pipe into the hole with epoxy glue.
I assembled the lamp with my youngest kid… Here is an overview of the process.
- Wrap the LED strip around the PVC pipe and mark where it should be glued to cover the whole length of the pipe
- Glue the LED strip onto the pipe and pass the wires through a hole at the bottom of the pipe
- Attach the RFID reader under the disk holder with small wood screws
- Attach the Arduino to the bottom of the lamp
- Glue the small LED in the center of the disk receptacle through a small hole
- Strip the transformer connector, pass it through a hole on the back of the lamp and make a knot
- Connect all the wires and connectors to the Arduino shield
- Screw the bottom of the lamp and install the rubber pads
- Et voilà!
You will find the Arduino code, the Sketchup drawing and the Fritzing circuit schematics on my github account at: https://github.com/pchretien/rgbrfid
Sometime in a project you end-up using a constellation of applications not many peoples are using at the same time. This is my case in the project I am actually working on. My project is a Java client that consumes a SOAP web service (CISCO AXL) through the Axis2 toolkit. I am developing in the Eclipse (Juno) Java IDE. The service is hosted on a server that can only be accessed using an SSL (https) connection. To add to the challenge, for most of our customers, the server certificate is issued by a non trusted CA.
When you say SOAP web service, you think Fiddler. It is almost impossible to get it done without seeing what is sent and received over the wire. This is where the fun begins. Having all these pieces working together took me several hours to figure out so, here is the solution I came with, hoping this will help someone crying in the dark out there.
WARNING: This is serious stuff. We are playing with certificate authorities and screwing up the chain of trust. DON’T DO THIS ON A PRODUCTION COMPUTER. This is intended for development environment only.
Ok … the disclaimer stuff being done, the first step is to make it work with your browser. You want to get rid of the warning messages blocking you from accessing the web service port because of the bad server certificate. To do this, you must add the server certificate CA to your Trusted Root Certificate Authorities. When you hit the web page, the browser allows you to view ans save the server certificate. Save it in the .cer format and start your Certificate Manager. In Windows this is an mmc plugin. From there you can import the CA certificate to your computer Trusted Rood Certificate Authorities store. You should now be able to navigate to the web service port using your browser. This allows you to access the service WSDL and generate your proxy using WSDL2Java.
Your next problem will show up when running your app using that brand new proxy. Even if the server certificate is now trusted by your computer, the Java JRE have it’s own trusted certificates key store and will block access to this server. You will have to add this server certificate to the JRE certificate store by following these instructions …
- Go to the JRE’s security folder at $JAVA_HOME/jre/lib/security
- To list the trusted certificates issue following command: keytool -list -keystore cacerts
- To add a certificate in this list: keytool -import -keystore cacerts -file C:\certnew.cer
- Enter “Y” to confirm …
- The default password for cacerts is changeit
At this point you should be able to run your Java client using the proxy code generated by the Axis2/WSDL2Java generator.
Ok … that was fairly common stuff. Now, let’s say you want to see what your application is sending to the server over the wire. This is not that easy since everything is encrypted when using an SSL connection (https). I used Fiddler to do the work. Out of the box, Fiddler will catch most of the traffic coming from and to your browsers. To display the content of the messages sent and received by your Java app while debugging in Eclipse, you will need to make a few more tweaks to your project environment.
Fiddler acts as a web proxy so the idea is to configure Fiddler as your proxy when debugging stuff in Eclipse. This is done by adding the following VM arguments to your debug configuration:
These arguments will forward all the standard and SSL http traffic to the Fiddler proxy, Fiddler proxy default port is 8888. You can change in the program options.
Once the traffic is forwarded to the Fiddler proxy, you need a way to see what’s in the message. You can do this by activating the “Decrypt HTTPS traffic” option in the “Tools->Fiddler Options->HTTPS” configuration page. This action will generate a dummy certificate and add it to your trusted root CA. Remember not to do this on a production computer!
In some cases, this will be enough to see the content of the https messages but, in our case, there is one more step to do. Remember the Java trusted CAs store? That’s it, you have to export the new Fiddler certificate and install it in the JRE certificate store.
You can find the Fiddler certificate in your computer certificate store under the name “DO_NOT_TRUST_FiddlerRoot”. Save the certificate in a .cer file and import it to the Java certificate store by following the same instructions as for the server certificate. One last thing. The Fiddler certificate default alias is “mykey” which already exist in the Java certificate store. Use the -alias option of the keytool app to change to a unique name: keytool -import -keystore cacerts -alias myalias123 -file C:\fiddlercert.cer.
You are done. You should now be able to debug your Java/Axis2 client in Eclipse and see, in Fiddler, the content of the SOAP messages sent and received from the server.
I published my first Android application, “Open APOD”, on the Google Play Store. I have developed this application to learn Android programming. You can get all the sources on my github or download it from Google Play. The application is Open Source and free of all charges. Get it, comment it, rate it …
I spent the last week or so learning Android programming. I find it important, in the learning of a new programming tool, to write something with clear specifications. This forces you to work on the best solution instead of using easy to code work-arounds.
The specifications are:
- The application should allow the user to read the Astrophotography Picture Of the Day published by NASA at http://apod.nasa.gov/apod on it’s Android device
- The application needs to be compatible with Android 1.5 (SDK #3)
- The user should be able to access the APOD for any date since june 16th 1995
- The user should be able to directly access the APOD of the current day
- The user should be able to navigate to the previous and next APODs
- The user should be able to navigate to the previous and next APODs with fling gestures
- The user should be able to view the picture in full size by clicking the preview picture
- The user should be redirected to the APOD website when clicking on the full size picture
These were the initial requirements … I will add some more stuff in the upcoming days:
- Change the full size picture activity from a WebView to an ImageView. This will allow the implementation of the OnClickListener callback and the re-use of the image bitmap in memory.
- Caching of the APODs on the SD card. This will save bandwidth, an important issue when using mobile networks.
- Adding a splash screen while loading the first APOD. Since loading the images can take a while on mobile networks, a splash screen with a spinner would look more professional.
The actual version of the project is published on my Github at the following address:
https://github.com/pchretien/APOD Feel free to fork, copying is not stealing!