Author Topic: Arduino 7-Seg Bubble LED Multiplexer Driver  (Read 4807 times)

0 Members and 1 Guest are viewing this topic.

Offline TheEPROM9Topic starter

  • Frequent Contributor
  • **
  • Posts: 254
  • Country: gb
  • I have a Kali USB and I'm not afraid to use it!
    • EPROM 9 Home
Arduino 7-Seg Bubble LED Multiplexer Driver
« on: October 13, 2015, 11:09:43 am »
Here is a Arduino project I have been working on for building a clock type thing. I ported the alphabet to it minus 6 charitors. Here is the latest code.

// Pin enables

char segs[20][8]=
{
  {1,1,1,0,1,1,1,0},  //A 0
  {0,0,1,1,1,1,1,0},  //B 1
  {1,0,0,1,1,1,0,0},  //C 2
  {0,1,1,1,1,0,1,0},  //d 3
  {1,0,0,1,1,1,1,0},  //E 4
  {1,0,0,0,1,1,1,0},  //F 5
  {1,1,1,1,0,1,1,0},  //g 6
  {0,1,1,0,1,1,1,0},  //H 7
  {0,0,0,0,1,1,0,0},  //I 8
  {0,1,1,1,1,0,0,0},  //J 9
  //k
  {0,0,0,1,1,1,0,0},  //L 10
  //m
  {0,0,1,0,1,0,1,0},  //n 11
  {1,1,1,1,1,1,0,0},  //O 12
  {1,1,0,0,1,1,1,0},  //P 13
  {1,1,1,0,0,1,1,0},  //q 14
  {0,0,0,0,1,0,1,0},  //r 15
  {1,0,1,1,0,1,1,0},  //S 16
  {0,0,0,1,1,1,1,0},  //t 17
  {0,0,1,1,1,0,0,0},  //u 18
  //v
  //w
  //x
  {0,1,1,1,0,1,1,0}   //y 19
  //z
};

void setup()
{
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
 
  pinMode(0, OUTPUT);
  pinMode(1, OUTPUT);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
}

void sevenSegWrite(byte digit)  //Loop that retreves data from array
{
  byte pin = 0;
  for (byte segCount = 0; segCount < 8; ++segCount) {
    digitalWrite(pin, segs[digit][segCount]);
    ++pin;
  }
}

void loop()
{
  PORTB |= _BV(PORTB0);   //Pin HIGH
  PORTB |= _BV(PORTB1);
  PORTB |= _BV(PORTB2);
  PORTB &= ~_BV(PORTB3);  //Pin LOW
 
  sevenSegWrite(2);  //Wright char
 
  delay(1);
 
  PORTB |= _BV(PORTB0);   //Multiplxed digit
  PORTB |= _BV(PORTB1);
  PORTB &= ~_BV(PORTB2);
  PORTB |= _BV(PORTB3);
 
  sevenSegWrite(18);
 
  delay(1);
 
  PORTB |= _BV(PORTB0);
  PORTB &= ~_BV(PORTB1);
  PORTB |= _BV(PORTB2);
  PORTB |= _BV(PORTB3);
 
  sevenSegWrite(11);
 
  delay(1);
 
  PORTB &= ~_BV(PORTB0);
  PORTB |= _BV(PORTB1);
  PORTB |= _BV(PORTB2);
  PORTB |= _BV(PORTB3);
 
  sevenSegWrite(17);
 
 
  delay(1);
}

Have fun working out what it is saying and also suggested improvements and refinements are welcome. I also would like to thank Ash Evens and Vin Narwani for helping with the current software development.
TheEPROM9 (The Husky Hunter Collectors inc.)
Knowledge should be sheared freely to those who want it.
https://www.flickr.com/photos/146977913@N06/ https://www.youtube.com/channel/UC4vOnjz1G-aM8LddSbrK1Vg https://www.facebook.com/groups/118910608126229/
 
The following users thanked this post: Raj

Offline TheEPROM9Topic starter

  • Frequent Contributor
  • **
  • Posts: 254
  • Country: gb
  • I have a Kali USB and I'm not afraid to use it!
    • EPROM 9 Home
Re: Arduino 7-Seg Bubble LED Multiplexer Driver
« Reply #1 on: October 13, 2015, 11:15:12 am »
Turns out the worst of my cameras, the file size is still to large to go up unedited.  |O

So here is the last of the images.
TheEPROM9 (The Husky Hunter Collectors inc.)
Knowledge should be sheared freely to those who want it.
https://www.flickr.com/photos/146977913@N06/ https://www.youtube.com/channel/UC4vOnjz1G-aM8LddSbrK1Vg https://www.facebook.com/groups/118910608126229/
 

Offline retrolefty

  • Super Contributor
  • ***
  • Posts: 1648
  • Country: us
  • measurement changes behavior
Re: Arduino 7-Seg Bubble LED Multiplexer Driver
« Reply #2 on: October 13, 2015, 01:40:28 pm »
Really cool.  :-+
 

Offline dferyance

  • Regular Contributor
  • *
  • Posts: 181
Re: Arduino 7-Seg Bubble LED Multiplexer Driver
« Reply #3 on: October 14, 2015, 09:18:20 pm »
One of the first projects I played with when trying out Cypress PSoC for the first time was to port some similar Arduino multiplexing code over to the PSoC. I was able to use the programmable digital to do the multiplexing and expose the different characters to the software as virtual registers. It greatly simplified the code as you just write to the individual digit registers and the display refresh all happens in the programmable digital blocks. Sometimes a little bit of hardware can really simplify the software. Just an idea in case you like playing with this kind of thing.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: Arduino 7-Seg Bubble LED Multiplexer Driver
« Reply #4 on: October 14, 2015, 09:25:25 pm »
On other processors without hardware multiplexing support (e.g. Microchip PICs without LCD controllers), one can simply write a timer driven multiplexing ISR, which presents a simple bitmapped virtual segment registers interface to the main program.  For efficiency reasons, its better to do the segment patten lookup in the main program rather than in the ISR.
 

Offline retrolefty

  • Super Contributor
  • ***
  • Posts: 1648
  • Country: us
  • measurement changes behavior
Re: Arduino 7-Seg Bubble LED Multiplexer Driver
« Reply #5 on: October 14, 2015, 11:47:11 pm »
On other processors without hardware multiplexing support (e.g. Microchip PICs without LCD controllers), one can simply write a timer driven multiplexing ISR, which presents a simple bitmapped virtual segment registers interface to the main program.  For efficiency reasons, its better to do the segment patten lookup in the main program rather than in the ISR.

 That is how I multiplexed a 5x5x5 LED cube project. Just used a contributed library (MStimer2) to generate a interrupt that would shift out a five long values to a shift register that had constant current outputs for the column drive using 25 of the bits, and setting one of five output pins to drive each level. Makes a nice seperation between the displaying of the cube data and the manipulation of the pattern desired.
 

Offline senso

  • Frequent Contributor
  • **
  • Posts: 951
  • Country: pt
    • My AVR tutorials
Re: Arduino 7-Seg Bubble LED Multiplexer Driver
« Reply #6 on: November 04, 2015, 10:02:54 am »
Turns out the worst of my cameras, the file size is still to large to go up unedited.  |O

So here is the last of the images.

Open in paint, crop it, resize to a lower resolution, save as .png, profit.
 

Offline crispy_tofu

  • Super Contributor
  • ***
  • Posts: 1124
  • Country: au
Re: Arduino 7-Seg Bubble LED Multiplexer Driver
« Reply #7 on: November 04, 2015, 10:23:24 am »
Thanks for sharing!  :popcorn: :-+
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf