Monday, Feb 18, 2013
Testing the Serial Port in Pure Python
So I'm working on porting the code from Aurora for eventual installation in Palo Alto. The code generates DMX512 signals in Python and sends it to LED drivers on the tree.
We are considering using the Raspberry Pi, so the first thing to do is to check that the serial driver on the Raspberry Pi can actually generate the DMX baud rate of 250,000 baud which is not a standard rate (which are multiples of 60 baud since back in the days of teletypes!)
A pro trick with the serial port is to send out a stream of "U"s, which are ASCII 0x55, so the bit stream looks like a square wave at half of the baud rate. Here's the python code to do exactly that:
And here's the result. A little noisy, but it's precisely at the expected frequency of 125 kHz.