Thursday 15 January 2015

Parallax Propeller Minimal Breadboard

I had an extra Paralllax Propeller left over from a project - I had ordered two in case I damaged one. I was wondering what I can do to get started with it. I searched the net and found a minimum breadboard setup for the parallax propeller, it was quick to put together.

Top View


The printed label on top of the propeller chip came from here. Note that I reduced the printing size to about 54%, which is little too small but good enough.

This was fun to put together and start reading about the Propeller chips datasheet. It is a very interesting design featuring 8 processor cores!

Side View, showing how the FTDI is connected

I don't own a Prop Plug but I found that using a cheap FTDI USB connector from ebay works. The propeller's reset pin has to be connected to the DTR signal. Note that I did everything under Linux and used Brad's Spin Tool to compile spin programs and upload them to the propeller.

Sunday 4 January 2015

Programming your Arduino with a USB asp

I recently bought a USB asp adapter in order to flash a stock bootloader on an Arduino UNO R3. I had flashed a bootloader that turns the Arduino into a USB Joystick device. I wanted to use the Arduino for a new purpose and realized that I could no longer flash the Arduino because it now identified itself as a joystick to my computer. At the time, I had only one Arduino UNO R3 to work with I decided I needed a dedicated tool to flash it. I bought the USB asp off of an ebay seller. It was cheap and came with little documentation.



First I had to figure out how to connect it to my Arduino. This is a straightforward matter of finding a mapping between the pins on the device and ISP header on the Arduino.

But, hooking it up is tedious work. I want to be able to plug it in simply, so I returned to ebay and found that a USB asp to Arduino ISP connector is available for cheap.


Now I can simply plug it in the ISP header on my Arduino when I need it.


Now I only need to remember which direction to plug it in. Fortunately, plugging it in the wrong direction seems to be a mistake without dire consequences for the Arduino.

When I tried to flash the bootloader onto the Arduino, I unfortunately got warnings and errors from avrdude. Note that I'm using Linux.

It turns out, that we need a udev rule to allow avrdude to read and write to the usb device. Here is an example rule that I added to a new file under /etc/udev/rules.d. 

/etc/udev/rules.d/99-usbasp.rules 

SUBSYSTEM=="usb", ATTR{idVendor}=="16c0", ATTR{idProduct}=="05dc", MODE="0666"

After restarting udev (sudo restart udev) amd plugging it the USBasp device, I was able to succesfully flash my Arduino.

It turns out that this device was also useful to use when I want to program a much older freeduino serial v1.0 from 1998. This early arduino clone doesn't have a FTDI chip and is finicky when programming it over a serial port. 

Using a Funduino LCM1602 LCD module with your Arduino

A while back, I bought a cheap i2c LCD module for my arduino off of ebay. It is a "funduino" module.



I was unsure of how to use it and it came without any documentation so I searched the internet for answers. Wiring it up is pretty straight forward, the Arduino i2c ports are fixed:

Here is a mapping from the Arduino to the back of the module.



  • A4 -> SCL
  • A5 -> SDA
  • 5V -> VCC
  • GND -> GND


Additionally, this module has a wrongly labelled backlight enable jumper. On the opposite side of the main connector there are two more pins labelled GND and VCC. Shorting these causes the backlight to turn on, if the backlight() function was called on the LiquidCrystal_I2C object in your sketch.



The standard LiquidCrystal Arduino library does not work with this i2c module. I found a module named LiquidCrystal_I2C which works and provides the same interface. Instead of constructing a LiquidCrystal object, you build a LiquidCrystal_I2C object and pass it the module's i2c address as the first parameter. In addition the module still requires the original parameters. For my module, the following snippet initializes it:


#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Addr, En, Rw, Rs, d4, d5, d6, d7, backlighpin, polarity

void setup() {
  lcd.begin(16, 2);
  lcd.backlight();
  lcd.print("Hello World");
}

While writing up these notes, I found that the last argument (the polarity argument) must be POSITIVE to enable usage of the backlight.