Archive

For July, 2014

An Arduino library for the MAX7219 Led Display Driver.

No Comments

The MAX7219 chip does a wonderful job when its time to drive either a 64 led matrix or an eight digit (seven segments) display. Only three wires are required: a chip select (CS), a data in (DIN) and a clock (CLK). The protocol is simple. I’ve written an Arduino library that implements this protocol. Specifications can be found at MAX7219.

The library comes with some code examples. Look in the File >> Examples >> CTTMAX7219 sub-menu in the Arduino IDE. Refer to the display and chip manufacturers to hook the display to the MAX7219 chip. This is straight forward. The display will likely need an external supply. If so, make sure that the Arduino board and the chip have a shared ground. You will need to modify the example code to specify the pins used to connect the DIN, CS and CLK pins of the chip to the Arduino. By default, these are:

/** Clock pin on the arduino. */
int pinCLK = 10;
/** Chip select pin on the arduino. */
int pinCS = 9;
/** Data IN on the arduino. */
int pinDIN = 8;

The download link of the library is CTTMAX7219_v1.0. You can install it through the Arduino IDE using the usual methods. Detailed information can be found at Installing Additional Arduino Libraries.

Trinket Support On Linux

No Comments

The Trinket (Adafruit’s Trinket) can be supported on Linux using the Arduino IDE 1.0.5 in only a few steps.

  1. Download this archive: TrinketHardwareSupport
  2. Install the Arduino IDE. It is assumed below that the main directory is arduino-1.0.5.
  3. Replace the current avrdude.conf in arduino-1.0.5/hardware/tools with the one in the downloaded in the archive. It is recommended that you make a backup of the current avrdude.conf file.
  4. Open a terminal window and run the Arduino IDE as root. You can issue the following command as long as the current directory is the Arduino directory where you installed it (arduino-1.0.5).

    sudo ./arduino

  5. Quit the Arduino IDE
  6. A directory called sketchbook should have been created in /root.
  7. Copy the directory hardware from the downloaded archive in /root/sketchbook.
  8. Within the Arduino IDE, from the Tools/Board menu item, select Adafruit Trinket 8 MHz
  9. Within the Arduino IDE, from the Tools/Programmer menu item, select USBtinyISP

A simple test can be done assuming that the Trinket is plugged on the PC.

  1. From File/Examples/01.Basics, select Blink
  2. Change value of the global variable led to 1.
  3. Upload the sketch to the Trinket
  4. The red led on the Trinket should be blinking.

How to restore the Arduino Bootloader?

No Comments

It can be easily done using Linux. This procedure is for the 328p processor. It can easily be adapted for a 168 processor. You will need an ICSP. First, make sure that avrdude is installed. It can be installed by issuing the command:

sudo apt-get install avrdude

You will need to retrieve the bootloader. It can be found in the hardware/arduino/bootloaders/atmega directory in the 1.0.5 Arduino IDE download. It is named ATmegaBOOT_168_atmega328.hex.

  1. Put the chip on an Arduino board.
  2. Connect the ICSP to the Arduino board.
  3. Power the Arduino with an external source.
  4. Connect the ICSP to the computer. Find its serial port. Most of the time, it is listed in the system log. The command ‘dmesg’ can be used to find it out. Look at the last lines.
  5. Open a command line window.
  6. Issue the following commands. Replace /dev/ttyACM0 by the proper ICSP port.
    /usr/bin/avrdude -c avrispv2 -p m328p -P /dev/ttyACM0 -e

    /usr/bin/avrdude -c avrispv2 -p m328p -P /dev/ttyACM0 -U flash:w:ATmegaBOOT_168_atmega328.hex

  7. Unplug the ICSP and reset the Arduino board.
Blue Taste Theme created by Jabox