Our products, Nanode, wireless, MCUs, electronics and more

A slick threaded GUI for Arduino projects with Python and Qt

Posted: May 16th, 2011 | Author: | Filed under: Uncategorized | Tags: , , , , , | Comments Off on A slick threaded GUI for Arduino projects with Python and Qt

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:

void setup() {
Serial.begin(115200);
}
void loop() {
Serial.println("I blinked");
delay(1000);
}

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!


MintyTime Mod

Posted: May 12th, 2011 | Author: | 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!


A $25 computer

Posted: May 6th, 2011 | Author: | 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.


Wireless Communications Using Reflected Sunlight

Posted: May 3rd, 2011 | Author: | Filed under: Uncategorized | Comments Off on Wireless Communications Using Reflected Sunlight


I’ve got to try this sometime, really captures the imagination


MintyTime on InMojo

Posted: May 3rd, 2011 | Author: | Filed under: Uncategorized | Comments Off on MintyTime on InMojo

MintyTime is front and center in pic on Open Source hardware article, thanks to our reseller InMojo.

Techcrunch article here.


Politicians can be hackers too …

Posted: April 12th, 2011 | Author: | Filed under: Uncategorized | Comments Off on Politicians can be hackers too …

… and our greatest allies. Silverton’s mayor tinkers with historical penny parking meters to retain their 1940s look but modernize function.

“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.”

Via.


Walking table

Posted: April 11th, 2011 | Author: | Filed under: Uncategorized | Comments Off on Walking table

This is pretty cool, and reminds me of Theo Jansen’s Strandbeests.

Via


OSHW Logo selected

Posted: April 7th, 2011 | Author: | Filed under: Uncategorized | Comments Off on OSHW Logo selected

An open source hardware logo has been chosen.


Plato, MO, is new US center of population

Posted: March 31st, 2011 | Author: | Filed under: Uncategorized | Comments Off on Plato, MO, is new US center of population

Plato, MO, zip 65552 is the US center of population following the 2010 census.


Python + Arduino + Win7 x64

Posted: March 31st, 2011 | Author: | Filed under: Uncategorized | Tags: , , | Comments Off on Python + Arduino + Win7 x64

If you are using Python on Windows 7 to talk to your Arduino, you definitely want the 32 bit version of Python.