Having your Arduino communicate over the serial monitor is nice, but for longer running installations and apps, a GUI is a good way to go. This blog post shows how to use a threaded GUI client to listen to the Arduino. It uses Python and Qt, from Nokia.
This example is as simple as possible. It uses threading to control the GUI, and a queue to communicate between the Arduino and the GUI.
Tools
There are many GUI toolkits available, but I like Qt. It is world class, fully cross platform, and presents a professional looking result. Also, it has a cool system of signals to communicate between objects, avoiding callbacks. This means it is safe. If you are going to build professional GUI’s with Python, in my opinion Qt is the way to go. This tutorial uses Qt4.7 and Python 2.7 (I imagine anything over Python 2.4 will work, but I haven’t tried).
I’m a big fan of Python, because it is an easy general purpose language and doesn’t get in the way of my brain while I’m problem solving. To get Qt and Python talking, we use PyQt. You can use PySide as well.
Setup
To get started, you need to install Python (Mac and Linux have it pre-installed), PyQt and pySerial. I like easy_install, a Python package installer. You might as well download Qt4 while you’re at it – I recommend going the whole hog and getting the Qt Creator Binaries for your system. It includes Qt Designer, which is nifty.
The GUI
Next step is running the GUI application. Download ArduinoPyQt.txt and rename it to ArduinoPyQt.py. Before we go over what it does, run it from your IDE or Python ArduinoPyQt.py from the command line to check it works. It should bring up a window like the picture above, but blank. (I’m on Win7 – the skin will match whatever system you are on.) It is blank because we don’t have the Arduino connected yet.
The Arduino sketch
We’re going to use the most trivial Arduino sketch possible. Here it is:
It just pushes “I blinked” down the serial port once every second. Couldn’t be simpler! Connect your ‘Duino and load that up using the Arduino IDE.
The last thing you need to do is to make sure that the serial port is correct. Go into the code and change SERIALPORT to whatever the correct port is for your ‘Duino.
Run the sketch again, and it should be saying “I blinked” once every second. You see it? Yay!
Posted: May 12th, 2011 | Author:admin | Filed under:Uncategorized | Comments Off on MintyTime Mod
MintyTime maker Alan sent up pictures of his innovative construction. He wanted to showcase the chips and the circuit board, but insert the LEDs in right way around. To do this, he mounted the Tiny2313 and 74HC595 shift register on the back of the board. This is impossible, because it requires a mirror image of the chip. Or so we thought. Alan did it …. by bending the pins 180 degrees around, and mounting the chips in upside down.
This is a tricky procedure, so “don’t try this at home” unless you are OK with risking the pins breaking off, and have lots of patience. I gotta say, though, the result is pretty darned cool!
Posted: May 6th, 2011 | Author:admin | Filed under:Uncategorized | Comments Off on A $25 computer
Here is neat idea/proposal from Raspberry Pi, a UK Charity. Details are scanty at the moment, but here is the essence of it, from their page:
Our first product is about the size of a USB key, and is designed to plug into a TV or be combined with a touch screen for a low cost tablet. The expected price is $25 for a fully-configured system.
I don’t know if it is open source or not, and have contacted them to ask.
“Rasmussen, who said he’s been in town long enough to be “romantically attached to penny parking meters,” took to his workshop to develop another option.
Tinkering with a 1949 mechanical meter, the 62-year-old firmware engineer converted it into a modern digital meter, without sacrificing vintage flair.”