Saturday, November 28, 2015

Infra Red Remote Controller Shield

Made use of The Forge makerspace at North Branch library to construct my first Arduino Shield. This shield adds 7 Status LEDs, an Infra Red LED, an Infra Red Receiver and a piezo buzzer.

Signal processing is handled by a great Arduino library written by Ken Shirriff and allows you to easily send and receive IR data.

In order to use the tone function I had to change which Timer the Infra Red Remote Library uses so it would not conflict. Other than that, the Infra Red Remote Library works very well. In the video below I test the shield using a sketch that plays a different tone for various buttons pressed on an old clarion remote control I found lying around.


Ken Shirrif used this library for several applications:

Other projects that use this library

Saturday, November 21, 2015

8x16 LED matrix controlled by 2 MAX7219's - requires only 3 Arduino pins

Expanding on my experiment with the MAX7219 controlling an 8x8 LED Matrix I added a second one. Both of the 8x8 displays and controllers were part of kits that couldn't fit neatly side by side, but the concept can still be demonstrated.

Using the circuit layout of the MAX7219 8X8 Red Dot LED Matrix Kit proved cumbersome as it didn't provide enough room to get the 8x8 LED panels close together and when you add additional devices the library expects to see them to the left of the previous device.  No big deal for testing. I would like to wire up a board that all three could neatly mount on and present a nice 8x24 display.

Here is a video of the 8x16 display created by cascading two of the MAX7219 controllers together.

UltraSonic Arduino How To - Parking your car with an Arduino

Using a Maxbotix Range Finder, Kevin Dahhar show you how to make a circuit that helps you back your car up into the garage, and put the Arduino into a super low power sleep when the circuit is not needed.

The Arduino only runs off of batteries and because it is kept in the super low power sleep mode the batteries last for months.

Only when the garage door is opened will the Arduino turn on due to the garage light activating a photocell and transistor circuit that signals an interrupt on the Arduino.

The code is well commented and very educational in itself.  You can look at it here

The video below is long but well worth the watch

Friday, November 20, 2015

MAX7219 and 8x8 LED Matrix on breadboard

I popped the MAX7219 and 8x8 LED Matrix from the kit and made it a little more social (watch video to see what I mean).  Using the MAX7219 requires only 3 pins from the arduino, a couple capacitors and resistor.  All the multiplexing is handled by the chip.  When writing to the device you shift out two bytes, one is the operand the second is the actual segment data.

The library hides that from you so you can simply turn on and off individual leds, rows or columns.

See my prior post, MAX7219 8X8 Red Dot LED Matrix Kit, for more details

Nootropic design 16x32 RGB backpack from Adafruit

Last night I put together the Nootropic design 16x32 RGB backpack from  Adafruit to power a 16x32 display (also obtained from Adafruit.

The backpack kit is only $12.95 at the time of this writing. connects to the back of the Adafruit 16x32 RGB LED Matrix Panel and is a very convenient way to control this awesome panel. The board is simply a small Arduino. You can easily program the board using the Arduino IDE. As you can see from the video below, it's possible to create great color animations, completely in Arduino programming!

Here is a video of mine running.  I cannot wait to dig further into this.

Tuesday, November 17, 2015

MAX7219 8X8 Red Dot LED Matrix Kit

After reading up on Project #21: Creating an LED Matrix in The Arduino Workshop I set out to find a 8x8 common cathode led matrix.  I saw this MAX7219 8X8 Red Dot LED Matrix Kit on Amazon and while I was looking to experiment with using two 74HC595's to control the rows and columns of the 8x8 matrix, this MAX7219 chip that did it all caught my curiosity.

So I ordered the kit.  :-)

Amazon Prime delivered quickly and the kit was relatively easy to solder.  Both the 8x8 display and the MAX7219 are socketed so you can easily remove them if you want to use in  a different project.  From the looks of it the board can be easily cascaded with other devices to create larger displays.  John Boxall does exactly that in his book The Arduino Workshop and posts a copy of the project online here.

The LedControl Arduino library has full support of the MAX7219 to control an 8x8 display.  The library does all the shifting out and multiplexing of row and column leds...All you do is tell it the row and column of the led you would like to turn on or off!

One single MAX7219 can also control up to 8 7segment displays.  Unlike my prior example, where each 7 segment display is driven by an individual 74HC595, the MAX7219 multiplexes the 7 segment displays so that only one is on at a time.  This cuts the current usage and because of the persistence of vision it appears that all 8 digits are on constantly.

So here is a peek at my finished MAX7219 8X8 Red Dot LED Matrix Kit running the test program.

#include "LedControl.h" //  need the library
LedControl lc=LedControl(12,11,10,1); // 

// pin 12 is connected to the MAX7219 pin 1 - Data In
// pin 11 is connected to the CLK pin 13
// pin 10 is connected to LOAD pin 12
// 1 as we are only using 1 MAX7219

void setup()
  // the zero refers to the MAX7219 number, it is zero for 1 chip
  lc.shutdown(0,false);// turn off power saving, enables display
  lc.setIntensity(0,8);// sets brightness (0~15 possible values)
  lc.clearDisplay(0);// clear screen
void loop()
  for (int row=0; row<8; row++)
    for (int col=0; col<8; col++)
      lc.setLed(0,col,row,true); // turns on LED at col, row

  for (int row=0; row<8; row++)
    for (int col=0; col<8; col++)
      lc.setLed(0,col,row,false); // turns off LED at col, row

Monday, November 16, 2015

Creating a Four Digit Display Using 74HC595 Shift Registers

My last experiment was with the three 74HC595s I was using to create the Knightrider effect on 24 leds.  In this experiment I am going to add another 74HC595 and use all four to control four common-cathode seven-segment LED displays.

To duplicate this setup you will need the following hardware:

Connections from Arduino in my setup

Pin 12 of the Arduino goes to pin 5 (the latch pin) on all of the 74HC595 shift registers.  When data is shifted out in serial to the shift registers this pin is first taken low then brought back high once the data has been shifted out and needs to be presented to the outputs of the shift registers.

Pin 11 of the Arduino goes to pin 6 on all of the 74HC595 shift registers.  This pin is clocked for each bit that is shifted in.  This pin is used by the ShiftOut() library function to clock data into the shift registers.

Pin 14 of the Arduino is being used as the Serial Data Input to the shift registers.

In order for the serial data to flow to all four of the shift regisers, pin 9 of shift register 1 (my least significant digit, holding the ones position) will connect to pin 14 of shift register 2 (digit holding the 10's position).  Pin 9 of shift register 2 will feed into pin 14 of shift register 3 (100's digit) and pin 9 of shift register 3 will feed into pin 14 of shift register 4 (1,000's digit).

Anytime I update the display it will involve four calls to the ShiftOut() routine:

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, digits[digit3]); 
shiftOut(dataPin, clockPin, LSBFIRST, digits[digit2]);
shiftOut(dataPin, clockPin, LSBFIRST, digits[digit1]);
shiftOut(dataPin, clockPin, LSBFIRST, digits[digit0]);
digitalWrite(latchPin, HIGH);

Connections to 7 Segment Display

LED pins A through G connect to pins Q0 through Q6 and DP connects to Q7 via current limiting resistors

Wiring the Display 

Each 7  segment display is going to have 8 resistors associated with it.  I placed those 8 above the display on the breadboard and connected them to the 7 segment in the following order:
DP (pin5), G (pin 10), F (pin9), E (pin 1), D (pin 2), C (pin 4), B (pin 6), A (pin 7).

Once I completed that wiring you might consider applying power to the board and testing by jumpering  5 volts to each resistor and confirming that the appropriate segment lights on your display.

Now that the resistors are in place and connected to the 7 segment displays you can connect the shift registers.  Each 7 segment display is being driven by it's own shift register.  Following the order laid out for the 7 segment display you will connect Q7 to the resistor on DP, Q6 to the resistor on G, Q5 to F, Q4 to E, Q3 to D, Q2 to C, Q1 to B and Q0 to A.

NOTE: A more practical way to have a 7 segment display would be using an Adafruit 0.56 4-digit 7-Segment Display w/I2C backpack and only using two pins on the Arduino.  The backpack also multiplexes the displays so the current requirements are much lower.  This experiment is an exercise in using the shift registers that were already breadboarded.

Here is a video of the display counting 0 through 13,000 with no delay between counts.  Once the count goes over 9,999 it will display dashes.

Here is the code I use to test the display.  I have it display dashes if the number is above 9,999, or out of range: