Showing posts with label windows phone 8. Show all posts
Showing posts with label windows phone 8. Show all posts

Sunday, September 28, 2014

Adafruit NeoPixels + Windows Phone 8

This is something that i wanted to do since a long time. Individual control of RGB LEDs on the Adafruit NeoPixel Shield over a bluetooth connection using my Lumia 920 running the Windows Phone 8, After extensively surfing MSDN help articles on WP8 APIs etc - Finally finished it this weekend.

Find the updated design, click here

In brief the design goes like this - An Adafruit NeoPixel shield containing 40 WS2812B 4-pin chip RGB LEDs in a 5 x 8 matrix pattern is mounted on an Adafruit Bluetooth Shield, the EZ Link which is stacked over an Arduino UNO. The code running in the Arduino reads the commands received on the serial bluetooth link, parses it and controls the RGB LEDs. The command packet sent from the Windows Phone consists of 5 fields - two fields for the X and Y co-ordinates of the LED and 3 fields for the R,G and B data obtained from the color picker.

The application on the windows phone is simply a grid of tiles created using the Coding4Fun WP toolkit. Each tile is identified uniquely by its name. Each tile can be set to a different color when clicked and has a one to one mapping with the LEDs on the adafruit shield. The color can be previewed in realtime. Some application statistics and setup are shown in below images. Once the code is well-organized i shall put it up here, and no, i did not write 40 event handlers for each of the tiles. There is only one event handler to rule them all :P

Once powered up the Arduino waits for a command on the BT Serial interface. When the application is started on the windows phone it establishes a connection with the BT module. On clicking any of the square tiles in the main application window another window opens up from where the color for that particular LED can be chosen. Alternatively all the LEDs can be turned off using the Turn Off button. The two wires in the pic below are the RX/TX pins from the BT shield connected to the Arduino over the SoftSerial interface...





P.S - The red color of the tiles is the default theme color on application startup. The LEDs do not get affected by this color unless programmed to




Here is an earlier experiment with a s ingle RGB LED breakout using Processing. The code for this can be found in the description of the video....






Thursday, August 14, 2014

Visible Light Communications - Lumia 920 Windows Phone + Galaxy S5 Android

While i wait for the components to arrive i am trying some new stuff using the existing setup. Here is how i implemented a VLC data transmitter using the Windows Phone 8.0 - A Nokia Lumia 920....

--- A few eons later ---

Well this just did not turn out to be good. I tried to modulate the flash of the camera on both the Lumia 920 Windows phone and Android Galaxy S5 with similar results - It Does Not Work !! The maximum modulation frequency i got was around 33 Hz for both the devices. I believe achieving higher data rates using onboard timer mechanisms of the OS just does not work. If you are reading this and are an expert on Android or Windows Phone Operating systems, i would be glad if you could give this a try or even sugesst me how to achieve high resolution timers that operate without giving any distortion / timing errors if i use them to modulate the camera flash. The image below shows the application. Turn On / Turn Off just switch the flash ON/OFF using the torch mode. Timed button activates a timer based on the DispatchTimer class. The time duration is taken from the Textbox. Similarly the Pool Timer button activates a timer created using the ThreadPoolTimer class.


As an example here is the code from my windows phone program. P.S - This code was adapted from several examples i found on the internet and after doing a brief study on the WP8 How Tos. I do not major in WP8 programming ;) So if you spot something wierd please let me know...