Arduino 7-Seg Bubble LED Multiplexer Driver - Page 1
Forum section: electronics / general

author: TheEPROM9
author_rank: Frequent Contributor
timestamp: October 13, 2015, 11:09:43 am
content: 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 enableschar segs={{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);++pin;}}void loop(){PORTB |= _BV(PORTB0); //Pin HIGHPORTB |= _BV(PORTB1);PORTB |= _BV(PORTB2);PORTB &= ~_BV(PORTB3); //Pin LOWsevenSegWrite(2); //Wright chardelay(1);PORTB |= _BV(PORTB0); //Multiplxed digitPORTB |= _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.

author: TheEPROM9
author_rank: Frequent Contributor
timestamp: October 13, 2015, 11:15:12 am
content: Turns out the worst of my cameras, the file size is still to large to go up unedited.So here is the last of the images.

author: retrolefty
author_rank: Super Contributor
timestamp: October 13, 2015, 01:40:28 pm
content: Really cool.

author: dferyance
author_rank: Regular Contributor
timestamp: October 14, 2015, 09:18:20 pm
content: 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.

author: Ian.M
author_rank: Super Contributor
timestamp: October 14, 2015, 09:25:25 pm
content: 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.

author: retrolefty
author_rank: Super Contributor
timestamp: October 14, 2015, 11:47:11 pm
content: Quote from: Ian.M on October 14, 2015, 09:25:25 pmThat 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.

author: senso
author_rank: Frequent Contributor
timestamp: November 04, 2015, 10:02:54 am
content: Quote from: TheEPROM9 on October 13, 2015, 11:15:12 amOpen in paint, crop it, resize to a lower resolution, save as .png, profit.

author: crispy_tofu
author_rank: Super Contributor
timestamp: November 04, 2015, 10:23:24 am
content: Thanks for sharing!