[TriEmbed] AllPixel Project Documentation

Pete Soper pete at soper.us
Thu Aug 27 21:57:43 CDT 2015


One thing to keep in mind with this and nearly everything else on a 
Raspberry Pi is that your program can be preempted at any time. 
Literally in the middle of one of the Python statements control may be 
yanked away and given to another process, then passed back to finish 
that statement an indeterminate time later. Between device interrupts 
and processor scheduling ("time slicing") with background daemons, there 
is a blizzard of program interruption going on more or less randomly. 
Depending on the system load (or just plain chance) you may see this 
never or a lot or anything in between. So don't be surprised if the 
simple code from the Adafruit tutorial below puts out some very funky 
numbers occasionally (i.e. they're completely crazy with respect to what 
you know the sensor should be reporting). There are ways to make the 
code immune to these kinds of errors, but it adds complexity. A 
relatively accurate time reckoning scheme for Python on Linux is in 
"answer 54" on this page 
<http://stackoverflow.com/questions/231767/what-does-the-yield-keyword-do-in-python?rq=1>. 
I just confirmed this works fine on my regular Linux system and think it 
ought to work just as well on an RPI. One way to reject bogosity is to 
toss a number that represents an impossible change in sensor readings. 
That is, if you know the sensor can't be reporting a room temperature of 
70 degrees one moment and 90 degrees the next, you can toss the 90 
degree reading. But this adds complexity and it won't be long before you 
want to use an ADC chip. :-)

And concidentally, tonight at Splatspace Geoff Tattersfield facilitated 
a session about using an MCP3008 ADC chip with a Raspberry Pi using the 
SPI bus. Folks went through this Adafruit tutorial 
<https://learn.adafruit.com/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi>.

-Pete

On 08/27/2015 09:32 PM, dan via TriEmbed wrote:
> I love it! And a very nice write-up too :) I'm definitely a fan of 
> using the lights to show different kinds of information (weather, 
> time, scores, etc.) I really like your weather display. Maybe you 
> could have chasing blue lights when it's going to rain, hehe.
>
> As a hardware nerd, I especially like the photoresistor RC timing 
> trick. I'd have never thought of that, but it makes perfect sense. 
> I'll have to keep that in mind for other projects :)
>
> For those curious, the adafruit article Chip linked to explains how 
> you can read restive sensors (like a photocell) using a Raspberry Pi's 
> GPIO pins without needing an external Analog-to-Digital converter 
> module. For simple sensors, this would be a great way to interface 
> them to the Pi on the cheap.
>
> https://learn.adafruit.com/basic-resistor-sensor-reading-on-raspberry-pi/how-it-works
>
> Thanks very much for sharing! Please keep us up to date if/when you 
> make any changes/additions!
>
> -Dan
>
>
>
> On Thu, Aug 27, 2015 at 7:24 PM, Charles McClelland via TriEmbed 
> <triembed at triembed.org <mailto:triembed at triembed.org>> wrote:
>
>     All,
>
>     From the last meeting, here
>     <https://www.hackster.io/chipmc/awesome-led-entertainment-center> is
>     the documentation for my Entertainment Center LED Geek makeover. 
>     Comments and suggestions are welcome but please be kind as this is
>     my first time programming in Python.
>
>     Thanks,
>
>     Chip
>
>
>     _______________________________________________
>     Triangle, NC Embedded Computing mailing list
>     TriEmbed at triembed.org <mailto:TriEmbed at triembed.org>
>     http://mail.triembed.org/mailman/listinfo/triembed_triembed.org
>     TriEmbed web site: http://TriEmbed.org
>
>
>
>
> _______________________________________________
> Triangle, NC Embedded Computing mailing list
> TriEmbed at triembed.org
> http://mail.triembed.org/mailman/listinfo/triembed_triembed.org
> TriEmbed web site: http://TriEmbed.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.triembed.org/pipermail/triembed_triembed.org/attachments/20150827/1194b0b8/attachment.html>


More information about the TriEmbed mailing list