Posts Tagged ‘Linux’

I just wanted to drop a couple quick links off. If you are like me and keep a bootable thumb drive on hand at all times these two links are worth clicking through:

And my tiny little buddy…:

These are great tools for troubleshooting hardware, etc on Windows machines!!!

The 28J60 is the chip used in Nuelectronics EtherShield and JeeLabs EtherCard. I started using it for the same reason that everyone else does. It’s cheap. I’m not going to blow your mind in this post with technical details on the chip or the libraries associated with it. My goal is simply to save you a little time if you have a board with this device parked on top of it. I really like the $25 version from JeeLabs. Here is a link to it via Modern Device:

The first place I would recommend stopping is the Nulectroniccs site for the basic library:

Next stop should be Simon Monk’s site for a library that simplifies the first library. I know that seems weird but trust me, the difference this makes for simple tasks is ridiculous:

The final stop in this tour to save a buck should probably be here for some inspiration:

If you survived all of that clicking and downloading and reading you should now have the ability to monitor an control digital and analog pins via the web.

** An important note is that if you are on a case sensitive Linux machine like me you’re going to have to clean up some of the references to the word “ethershield” in these libraries and sketches. “EtherShield”, “etherShield” and a few other versions of the word are mixed in there. Change a few file names, do a little find and replace and voila! You are in the club of people willing to spend 2 hours of labor to save $20. There’s nothing wrong with that, by the way. I’ve spent days disassembling things worth less than $5 just to see what’s inside. Later, Rob

I’m not going to be providing any ground breaking knowledge in this post as I’m not the first or even the 10,000th person to use a Python script to control an Arduino. My aim is simply to save you a little time if you are trying to do this for the first time.

The first order of business is to set up your Arduino board and take a few notes.

Here’s a cheesy sketch that toggles a few outputs depending on the character it sees on the Arduino’s RX pin. After you get this to work check out the “Firmata” library.

int firstOutput = 9;
int secondOutput = 10;
int inByte = 0;
void setup()
pinMode(firstOutput, OUTPUT);
pinMode(secondOutput, OUTPUT);
digitalWrite (firstOutput, LOW);
digitalWrite (secondOutput, LOW);
void loop()
if (Serial.available() > 0) {
inByte =;
if (inByte = 1) {
digitalWrite(firstOutput, HIGH);
digitalWrite(secondOutput, LOW);}
if (inByte = 2) {
digitalWrite(secondOutput, HIGH);
digitalWrite(firstOutput, LOW);}

After you download the sketch connect an LED and current limiting resistor in series from pin 9 to GND and from pin 10 to GND.

Click on the “Serial Monitor” button in your Arduino IDE. Set the baud to 9600. Make note of the serial port that’s being used (top of screen). Mine says “/dev/ttyUSB0”. You’ll need this info later.

Type “1” in the input line if the serial terminal (no quotes) and hit the “Send” button. One of your LEDs should turn on. Sending a “2” should toggle the LEDs. If this works move on. If not regroup and check your wiring.

Once you are able to toggle the LEDs it’s time to move on to the Python side of the equation. I’m not going to cover the install of Python or the pySerial plug in. This is covered elsewhere on line. Here’s a good place to start for the pySerial install:

Once you have Python and pySerial installed talking to Arduino is fairly straight forward. Open Python in your terminal. Just type “python” and hit Enter.

>>> import serial
>>> ser = serial.Serial(‘/dev/ttyUSB0’, 9600, timeout=1)
>>> ser.write(‘1’)
Hit Enter
>>> ser.write(‘2’)
Hit Enter

This should toggle the LEDs just like the Arduino Serial Monitor connection did.

What’s the next step? Let’s turn this into a simple script that toggles the outputs. Put the following in a text file and save it as “”. Note* your path to Python may be different…


import serial
import time
ser = serial.Serial(‘/dev/ttyUSB0’, 9600, timeout=1)


That should be it. In your terminal move into the directory that you just save the script in. Now just type “python” and something magical should happen to your LEDs. I’m crossing my fingers!

Here’s a little more info from

I’m going to assume you’re currently sittng in front of a Windows machine. Here are a few quick steps to burn your own Ubuntu live CD so that you can give the OS a try. I would highly recommend it. Everyone has their own opinion of which Linux distro is the best. I’m fond of Ubuntu because whether you’re a Mac or PC user most things are going to be fairly intuitive when you make the switch. So here we go…….

You’re going to need to download two pieces of software and have access to a drive that can burn a CD-ROM. Create a new folder on your desktop and call it Linux_Is_Awesome. Save the follwoing two pieces of software in this new folder.

The first piece of software you will need will be “InfraRecorder”. You can find it here:

The next piece of software you’ll need to download is the current version of “Ubuntu”. You can find it here:

We’re almost there…

Install InfraRecorder if you haven’t already done so.
Place a blank CD-ROM into your burner.
Open InfraRecorder.
Choose “Write Image”.
Select the Ubuntu image you just downloaded.
Select the appropriate drive letter for your burner.
Set the write speed to the lowest setting available
Click “Ok”.
This will probably take a few minutes…….

Once the CD-ROM is ready leave it in the drive, close the drive and reboot your machine. After the reboot you will have the opportunity to try Linux out without installing it. ENJOY!

I just wanted to share a few tools that I use to connect to my LAMP server to check status and occasionally modify settings or files from the couch. I run Ubuntu Server 10.10 on the LAMP server and Ubuntu 10.10 on my other machines. I have to admit that I have a Windows XP Pro machine downstairs to run Processing and for the wife and kids to manage their ITunes, etc.

ConnectBot – This is a secure shell (SSH) client for the Android platform. It works as advertised and can get you to your server’s command line from your Android device. In the Android Market search for “ConnectBot”.

AndFTP – This is a simple FTP client for the Android Platform. I haven’t had any real issues with it. If you need to get a few files from your tablet or phone to your server this app will get the job done. In the Android Market search for “AndFTP”.

Hacker’s Keyboard – This is a pretty nice keyboard that will add CTRL key access to your Android device. In the Android Market search for “Hacker’s Keyboard”.
Full Keyboard – This keyboard adds a D-Pad and quite a few more keys to your arsenal. There are times when it comes in handy but for most applications the Hacker’s Keyboard in landscape mode will get the job done a little more efficiently. In the Android Market search for “Full Keyboard”.

I have been working on modifying a Linksys router (WRT54G) that I picked up at Goodwill into a controller for an electric wifi controlled wheelchair robot. Along the way I found a cheap way to control an LCD remotely. Enjoy!

My parts list is:
(1) Blue, 4×20 LCD w/ LCD117 from Modern Device
(1) RBBB Arduino Clone from Modern Device
(1) Linksys WRT54G V2 from Goodwill running DD-WRT
*This tutorial will include the use of a Linux machine running Ubuntu 10.10. If you’re using a non Linux machine you’re on your own…. Sorry.

Why don’t you see a level shifter in the mix? The ATMega328P in my Arduino clone is fine with reading 3.3V logic on the RX pin. On side note, the chip is fine running at 3.3V source as well. This has been demonstrated by JeeLabs for a few years now.

So let’s begin……

The LCD wiring is as follows –
*This will work with the liquid crystal library as well if you don’t have an LCD117 board.
LCD power (LCD117) comes from one of the RBBB pins labeled as 5V.
LCD ground (LCD117) comes from one of the RBBB pins labeled GND.
LCD RX (LCD117) comes from the pin labeled PIN 9 on the RBBB.

The WRT54G wiring is as follows –
*You’ll have to verify the pin out of your specific router. This is documented on line pretty well. On my V2 the serial port is the 20 pin connector on the right front of the board.
RBBB GND pin to pin 9 on my router’s serial port.
RBBB RX pin to pin 3 on my router’s serial port.
This is it! I soldered female header to my router’s serial port in lieu of wire.

** I added an external 2.1mm power jack to my router so I can connect my clone to the router’s 12VDC supply. This is pretty wasteful but it saves me a few parts when the router is running on battery power.

Here’s the specific Arduino sketch I’m using to hand characters from the router, through the Arduino to the LCD. I guess in this example I’m using the Arduino as a level shifter that can do other stuff.

#define txPin 9
int incomingByte = 0;
SoftwareSerial LCD = SoftwareSerial(0, txPin);
void setup()
pinMode(txPin, OUTPUT);
LCD.print(“routerBot ACTIVATED?n”);
LCD.print(“echo ## > /dev/tts/1”);

void loop()
if (Serial.available() > 0) {
incomingByte =;

Download the sketch to your Arduino board.

Next, in your router’s admin page enable SSHD. Again this is documented on line pretty well.

Now let’s SSH in to the router-
Here’s how I do it.
Connect to your router via WiFi or an ethernet cable.
Open up a terminal. (CTL+ALT+T)
Type “ssh root@”. This is my router’s IP address. Yours may be different.
You may have to type “yes” next.
Now enter your router’s admin password.

Once you’re able to open up an SSH session with the router let’s slow down the serial port comm speed.
Type “stty -F /dev/tts/1 9600.”

If you’ve wired everything correctly reset the Arduino and you should see a message on the LCD. If it doesn’t work try resetting the board and waiting a few seconds.

Now, if we’ve done everything correctly to this point we can send a few characters over.
Type “echo ?f > /dev/tts/1”
This should clear the LCD. Replace the “?f” with whatever text you like now. “?n” will get you to the start of the next line on the LCD.