Message Boards Message Boards

Remote sensing on the RPi version 2 board

Now that we have access to a Raspberry Pi that is ___ times (insert whatever marking number you wish - I've seen 4 through 10) faster than its predecessor, we have a very functional front end for Mathematica. I decided to give the four cores a test drive with a remote sensing project. I've given details on my website here and also posted a video of it in action on youtube. (My apologies in advance for the poor focus and contrast in some parts.)

In short, what I've done is create a simple light sensor out of a photoresistor that is connected to an MCP3008 ADC. My wiringPiLink package allows for interacting with the MCP3008 through the function wiringPiAnalogRead. I use CreateScheduledTask to poll the sensor every 50 ms or so and then dynamically display this result on a AngularGauge:

enter image description here

When trying to design a plot of light intensity vs. time, I ran into some problems with dynamic variables and Manipulate, so I had to create my own simple dynamic interface for that tab, resulting in much better responsiveness from the program. I was pleasantly surprised to see that ProgressBar works really well.

enter image description here

The last part of the interface is not terribly useful, but shows that we can do some interesting analysis with not a lot of programming. Here I plot a Histogram of the light intensities and then test to see if the intensities fit a NormalDistribution. (In this case, they should, since I have set the source to Flicker, which is a function in my wiringPiLink package that changes the LED intensity based on a normal distribution.)

enter image description here

A reasonable fit is obtained, and I typically get better results when I collect more data (the flicker is updating on a 10 ms interval while the data collection is happening 5x per second).

To add the "remote" to my sensor, I am using a VNC connection. I simply followed these directions and set up a server with a geometry that matched my iPod Touch screen. I wouldn't use this solution if security were an issue, but at the moment all I'm doing is playing behind my personal firewall.

I've attached the code used to create the interface. Use at your own risk since there isn't a tremendous amount of debugging. Since it interacts with the GPIO, you'll need to run Mathematica as sudo.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract