7 segment counter

Hi everyone , i have a project that include connecting two 7 segments together to display an input that makes one of them for the units and the other for the tenth but i can't connect them together in a way that makes them count exactly correct as the tenth 7 segment usually starts by 1 whenever we try it and when the unit reach 9 then the tenth gets 2 not 1 as it already started with one  https://www.dropbox.com/s/w50bn9nk8fu7q5s/a7aneeeek.pdsprj?dl=0 http://i58.tinypic.com/1z4eucx.png

Topic by mina edward 4 years ago  |  last reply 4 years ago


7 segment display nsn64r

Hi!Is there anyone having data on nsn64r pinout ? I found a few of them but no pinout instructions.Thanks

Question by gonzo_one 4 months ago  |  last reply 3 months ago


10 bit to 7 segments

Hi everyone!! I'm posting because i need help! I want to make a 10 bit to 7 segments schematic/circuit. I need to just convert 10 bit binary to decimal.. In my idea i have 10 switches and every one of them represents a number in decimal. for example when i put ON my first switch from the right i want that in the 7 segments appears the number "1" and for example when i switch ON the last switch from the left it appears "512" and if all of them are ON appears 1023. So i have 10 ON/OFF switch and 4 (7 segment) display. I have a PIC programmer, so if anyone can help by hardware or software it would be great. Thank you very much!!!

Topic by Grieverjoao 5 years ago  |  last reply 5 years ago


How to make a 7 segment clock? Answered

Hi! i have 6 X 7 segment displays ( i think common annode) hanging around and i was wondering if i could make an clock with hours minutes seconds and an LED or 2 LED's that blinks every second, without an arduino. i do have an arduino for programming but i rather use other parts so that i can use my arduino for other projects. who can help me? Thanks!

Question by ingkiller 4 years ago  |  last reply 4 years ago


Trying to figure out how to make a 7 segment LED show random

Hey everyone I am working on a project where I would like to install one of these: http://cgi.ebay.com/10pcs-0-8inch-7-segmen...=item483fd1c0dd and have it display completely random things (dont even have to be numbers) How could I possible go about doing this? I would like to try and make it as simple as possible, Thanks!

Topic by snake126 8 years ago  |  last reply 8 years ago


4221 BCD to 7-Segment decoder

I'm looking for a 4221 BCD (not 8421) to 7-seg decoder IC. To be honest, I just want to copy the logic diagram to work on an assignment for my VHDL class. I can't find any ICs like this on google! Do they not exist? For what reason? Thanks, Daniel

Topic by samurai1200 11 years ago  |  last reply 11 years ago


stop 7-segment from ghosting?

I'm working on a simple arduino 7 segment driving circuit. (It also has a led bar-graph that displays binary numbers but that part is working fine.) When I get the display working I might make an instructible out of it. Here's the basic layout: -using this 8 segmet 4 digit common cathode display. -arduino controls what segments are on via 74HC164 8-bit Serial Shift Register -shift register controls an array of 8 PNP transistors with base and pull-up resistors -transistors connect to display anodes through resistor array -display cathodes (common for each digit) connected to array of 4 PNP transistors with base and pull-down resistors  -PNP transistors controlled by arduino. (I will post the schematic shortly.) In software, to display a four digit number, I shift the pattern for a given digit to the shift-register, which in turn turns on the PNPs for the corresponding segment anodes. I then turn on the NPN for that digit's cathode. I delay for a few milliseconds, then turn the NPN off, shift the next digit in, and turn the NPN for that digit on. Rinse and repeat. It works fine but the segments that should be off are at about 1/2 brightness, making all the digits look like eights. Even the DP looks like it's on and I'm not turning it on anywhere. Do I need pull-down resistors for the anodes or something? What's going on here?

Question by Vick Jr 7 years ago  |  last reply 7 years ago



How to set up a 7 segment display on an Arduino ?

 How would i set it up for this display? on the left side each pin is labeled from top to bottom D0 D1 D2 D3 and Digit on right side Top to bottom +9v+5v and GND (1st Pic)  The send Pic is just the bottom of the display. PLZ HELP Thanks!

Question by Dylan552 9 years ago  |  last reply 9 years ago


Read from a 7-segment display LCD

Hello everyone. Suppose you have some device with a numeric LCD display with some 7-segment digits (i.e. a digital scale), and you want to hack it in order to read out electronically (for example with an rs232 connection), while preserving functionality of the thing. How you would do that?

Topic by avvelenato 3 years ago  |  last reply 3 years ago


0-12V Digital Display?

Here's what I need, and haven't been able to figure out how to do it: I designed a motor speed controller that runs a 12V fan.  Speed control is via PWM through a 50K linear Potentiometer. I need to be able to read the percentage of run voltage ie: 0V=0%, 6V=50%, 12V=100%.  I want to display this on 3 7-segment LED displays. Anyone with insight would be greatly appreciated. Brian

Question by BrianAriz 3 years ago  |  last reply 3 years ago


7 segment led display driver help?

7 segment sed driver/decoder circuit helpEMAIL FLAGIve looked all over, and have already tried 3 circuits, but none work. They have either the wrong ic, wrong led display, etc. So, I want to make a circuit that, by using a decoder, I can flip 4 dip switches and make the display make certain numbers. I have a 7447 ic, common cathode led display, but I can only either find a circuit with a 7447 and a common anode, or a circuit with a common cathode but a different decoder (a latch/decoder/driver). Here is the first site I tried:http://www.allaboutcircuits.com/vol_6/chpt_7/9.htmlAnd when I finally flip the switches, nothing happens even though I made it exactly as shown. But it has a CMOS, so thats probably a big problem. I also tried this site:http://www.atilim.edu.tr/~hkar/lab5.htmBut it has a common anode, and when I tried it it didnt work. I have exactly ELS321HDB. And I have a power unit that can go from 5 - 18 volts. Can anyone show me how to make this? Im not too good yet at reading circuit diagrams, because I seem to make it way more complex then it should be.

Question by 101yummYYummy101 10 years ago


ICL7107 and LM35 based 7-segment thermometer

I'm trying to create a digital centigrade thermometer based on an ICL7107 3 1/2 digit 7-segment driver/ADC and an LM35 linear centigrade temperature sensor but I'm having a few problems. There doesn't seem to be much online about using the ICL7107 with a LM35 and most of the schematics available are for volt meters, but that's not a massive problem as the LM35 gives 10mV/C linearly. I'm just trying to go based on the few schematics I have found but I'm wondering about the supporting components for the LM35 which seem a little too simple. The first schematic I found was from a Hungarian electronics forum and seems to depict a diode and amplifier being used for the temperature sensing which seems like a bad idea to me. The second seems more like what I'm trying to do. The other few things are the negative voltage source, the first schematic shows an inverter being used as does the datasheet, but the second schematic shows an LMC7660 voltage converter which seems like a better option to me. The second one does also show three diodes in series used to drop the voltage for the LED displays which doesn't seem like the best idea, but I can't think of a better way to do it without attaching resistors to each one as the number of lit segments will be variable. The supporting components for the ICL7107 seem pretty consistent between the two and the schematic so I'm confident those are correct, but I'm looking for some advice on how to connect the LM35 in a way that will give me an accurate readout. Thanks!

Topic by andy70707 5 years ago  |  last reply 1 year ago


WANTED: someone to draw circuit

Here is my project  "Design a counter that will count the from 0 to 99 on two 7-segment indicator (display)." I need someone to draw me circuit and draw how to connect everything on breadboard. I will pay

Topic by dario1 7 years ago  |  last reply 7 years ago


What is a good schematic for a multimeter with an attiny85v and some 7 segment leds?

I want to make a multimeter out of an attiny85v, and some 7segment leds for a 12volt power supply that I made, I would like it to measure from 0.0V to 12.0 volts, with an accuracy of .1 volts. Anyone know any good circuits? EDIT: This is what I am looking for, except the author has not included any code http://fedetft.wordpress.com/2010/10/02/digital-voltmeter-for-power-supply/

Question by Michael_Bell 6 years ago  |  last reply 6 years ago


Help with Arduino programming for LED display

What I want to do is keep score with my coin soccer game. I will have 2 metal contacts in the goals that when a coin goes through it will break contact and send a signal to the Arduino having the contacts allways HIGH and then when its LOW, it changes an 7 segment LED. I am very new to programming and the C language. I think I can write the whole IF and ELSE statements but I don't know how to make the LED display change. I need the LED display to change after getting the signal from my Arduino by going up one number. It is a single 7 segment display. Can someone help me with the code for that? Thanks in advance.

Topic by Wally_Z 7 years ago  |  last reply 7 years ago


How do I use a Common Anode 7-Segment LED? Answered

I have a SA23-12EWA Common Anode 7-Segment LED and I can only get the decimal point to light up. How do I connect it so that the other segments light up?

Question by powerman666 6 years ago  |  last reply 6 years ago


Pin allocations on 4 digit, 7 segment LED display... Answered

Hi, I have recently bought a 4 digit, 7 segment LED display to hook up to my arduino and am unsure of what pin does what. I have a green KINGBRIGHT (2009-34) CA56-216WA (M3) and can not find it on the kingbright website. Also, while I was looking at the other models I noticed that some pins were labeled DP. If anyone can be of any assistance it would be greatly appreciated. Thanks again!  Ari

Question by anonymouse197 8 years ago  |  last reply 8 years ago


20 year old 7 segment 9 digit led display- PLEASE HELP TO FIGURE OUT PART NUMBER AND DATASHEET?

URGENT HELP APPRECIATED I have a 20 year old 7 segment 9 digit led display, i cannot figure out the part no. Here's is what is written in the back of it- (NSA 520 DCCB VO 0179-A) it has 9 digits, a segment below every digit, 7 segment per digit, 18 pin holes

Question by polkijain 5 years ago  |  last reply 5 years ago


How to I display voltage on a 7 segment display?

Okay, I've never actually come across this before or needed to do this but now i come to it, i realise I am really lost to it. What i need to do is display a 3 digit (hundreds eg. 342) number on three 7 segment displays. So pretty much I just need a 3 digit voltage read-out to be incorporated into a portable design. I've been looking around and have come across the Analog to Digital converters, and understand how they work, but I'm not sure how to incorporate them or to put it to any use. So if anyone knows or has a schematic or any information I could work off, please help. :)ThanksPyroten

Question by pyroten 9 years ago  |  last reply 6 years ago


7 segment sed driver/decoder circuit help

Ive looked all over, and have already tried 3 circuits, but none work. They have either the wrong ic, wrong led display, etc. So, I want to make a circuit that, by using a decoder, I can flip 4 dip switches and make the display make certain numbers. I have a 7447 ic, common cathode led display, but I can only either find a circuit with a 7447 and a common anode, or a circuit with a common cathode but a different decoder (a latch/decoder/driver). Here is the first site I tried:http://www.allaboutcircuits.com/vol_6/chpt_7/9.htmlAnd when I finally flip the switches, nothing happens even though I made it exactly as shown. But it has a CMOS, so thats probably a big problem. I also tried this site:http://www.atilim.edu.tr/~hkar/lab5.htmBut it has a common anode, and when I tried it it didnt work. I have exactly ELS321HDB. And I have a power unit that can go from 5 - 18 volts. Can anyone show me how to make this? Im not too good yet at reading circuit diagrams, because I seem to make it way more complex then it should be.

Question by 101yummYYummy101 10 years ago  |  last reply 7 years ago


new to arduino, want to run a dual display for 2 sensors

I'm new to the Arduino community.  wanting to set up a dual radar setup with 2 ultrasonic sensors,  (Ultrasonic Sensor Module HC-SR04), and outputting to a pair of 7 segment displays ( two 7 segment displays each).  I've found a code to do a single could use a lot of help to output two at the same time, basically 2 lanes without 2 units.  im using an arduino mega, ordered a unor3 and hopefully it can be made to run on one or the other. code is as follows: /* HC-SR04 Sensor    The circuit:     * VCC connection of the sensor attached to +5V     * GND connection of the sensor attached to ground     * TRIG connection of the sensor attached to digital pin 2     * ECHO connection of the sensor attached to digital pin 4  */    /*  This is a radar ping sensor that calcultates the speed of an  object traveling away or towards the sensor. I took some of this  code for the HC-SR04 Sensor implementation by Tautvidas Sipavicius. The rest  is original code from me. I know that the seven segment display  code is not the best to look at or the most optimized but it  serves its purpose just fine and is easy to understand.    Written by Matthew Ladd  */   const int trigPin = 2; const int echoPin = 4;   void setup() {   // initialize serial communication:   Serial.begin(9600);   //First 7 segment (ones place)   pinMode(30,OUTPUT);//F   pinMode(31,OUTPUT);//G   pinMode(32,OUTPUT);//E   pinMode(33,OUTPUT);//D   pinMode(34,OUTPUT);//C   pinMode(35,OUTPUT);//B   pinMode(36,OUTPUT);//A   //Second 7 segment (tens place)   pinMode(37,OUTPUT);//F   pinMode(38,OUTPUT);//G   pinMode(39,OUTPUT);//E   pinMode(40,OUTPUT);//D   pinMode(41,OUTPUT);//C   pinMode(42,OUTPUT);//B   pinMode(43,OUTPUT);//A } void zerofirst(){   digitalWrite(30,LOW);   digitalWrite(31,HIGH);   digitalWrite(32,LOW);   digitalWrite(33,LOW);   digitalWrite(34,LOW);   digitalWrite(35,LOW);   digitalWrite(36,LOW); } void onefirst(){   digitalWrite(30,HIGH);   digitalWrite(31,HIGH);   digitalWrite(32,HIGH);   digitalWrite(33,HIGH);   digitalWrite(34,LOW);   digitalWrite(35,LOW);   digitalWrite(36,HIGH); } void twofirst(){   digitalWrite(30,HIGH);//F   digitalWrite(31,LOW);//G   digitalWrite(32,LOW);//E   digitalWrite(33,LOW);//D   digitalWrite(34,HIGH);//C   digitalWrite(35,LOW);//B   digitalWrite(36,LOW);//A } void threefirst(){   digitalWrite(30,HIGH);//F   digitalWrite(31,LOW);//G   digitalWrite(32,HIGH);//E   digitalWrite(33,LOW);//D   digitalWrite(34,LOW);//C   digitalWrite(35,LOW);//B   digitalWrite(36,LOW);//A } void fourfirst(){   digitalWrite(30,LOW);//F   digitalWrite(31,LOW);//G   digitalWrite(32,HIGH);//E   digitalWrite(33,HIGH);//D   digitalWrite(34,LOW);//C   digitalWrite(35,LOW);//B   digitalWrite(36,HIGH);//A } void fivefirst(){   digitalWrite(30,LOW);//F   digitalWrite(31,LOW);//G   digitalWrite(32,HIGH);//E   digitalWrite(33,LOW);//D   digitalWrite(34,LOW);//C   digitalWrite(35,HIGH);//B   digitalWrite(36,LOW);//A } void sixfirst(){   digitalWrite(30,LOW);//F   digitalWrite(31,LOW);//G   digitalWrite(32,LOW);//E   digitalWrite(33,LOW);//D   digitalWrite(34,LOW);//C   digitalWrite(35,HIGH);//B   digitalWrite(36,LOW);//A } void sevenfirst(){   digitalWrite(30,HIGH);//F   digitalWrite(31,HIGH);//G   digitalWrite(32,HIGH);//E   digitalWrite(33,HIGH);//D   digitalWrite(34,LOW);//C   digitalWrite(35,LOW);//B   digitalWrite(36,LOW);//A } void eightfirst(){   digitalWrite(30,LOW);//F   digitalWrite(31,LOW);//G   digitalWrite(32,LOW);//E   digitalWrite(33,LOW);//D   digitalWrite(34,LOW);//C   digitalWrite(35,LOW);//B   digitalWrite(36,LOW);//A } void ninefirst(){   digitalWrite(30,LOW);//F   digitalWrite(31,LOW);//G   digitalWrite(32,HIGH);//E   digitalWrite(33,HIGH);//D   digitalWrite(34,LOW);//C   digitalWrite(35,LOW);//B   digitalWrite(36,LOW);//A } void zerosecond(){   digitalWrite(37,LOW);   digitalWrite(38,HIGH);   digitalWrite(39,LOW);   digitalWrite(40,LOW);   digitalWrite(41,LOW);   digitalWrite(42,LOW);   digitalWrite(43,LOW); } void onesecond(){   digitalWrite(37,HIGH);   digitalWrite(38,HIGH);   digitalWrite(39,HIGH);   digitalWrite(40,HIGH);   digitalWrite(41,LOW);   digitalWrite(42,LOW);   digitalWrite(43,HIGH); } void twosecond(){   digitalWrite(37,HIGH);//F   digitalWrite(38,LOW);//G   digitalWrite(39,LOW);//E   digitalWrite(40,LOW);//D   digitalWrite(41,HIGH);//C   digitalWrite(42,LOW);//B   digitalWrite(43,LOW);//A } void threesecond(){   digitalWrite(37,HIGH);//F   digitalWrite(38,LOW);//G   digitalWrite(39,HIGH);//E   digitalWrite(40,LOW);//D   digitalWrite(41,LOW);//C   digitalWrite(42,LOW);//B   digitalWrite(43,LOW);//A } void foursecond(){   digitalWrite(37,LOW);//F   digitalWrite(38,LOW);//G   digitalWrite(39,HIGH);//E   digitalWrite(40,HIGH);//D   digitalWrite(41,LOW);//C   digitalWrite(42,LOW);//B   digitalWrite(43,HIGH);//A } void fivesecond(){   digitalWrite(37,LOW);//F   digitalWrite(38,LOW);//G   digitalWrite(39,HIGH);//E   digitalWrite(40,LOW);//D   digitalWrite(41,LOW);//C   digitalWrite(42,HIGH);//B   digitalWrite(43,LOW);//A } void sixsecond(){   digitalWrite(37,LOW);//F   digitalWrite(38,LOW);//G   digitalWrite(39,LOW);//E   digitalWrite(40,LOW);//D   digitalWrite(41,LOW);//C   digitalWrite(42,HIGH);//B   digitalWrite(43,LOW);//A } void sevensecond(){   digitalWrite(37,HIGH);//F   digitalWrite(38,HIGH);//G   digitalWrite(39,HIGH);//E   digitalWrite(40,HIGH);//D   digitalWrite(41,LOW);//C   digitalWrite(42,LOW);//B   digitalWrite(43,LOW);//A } void eightsecond(){   digitalWrite(37,LOW);//F   digitalWrite(38,LOW);//G   digitalWrite(39,LOW);//E   digitalWrite(40,LOW);//D   digitalWrite(41,LOW);//C   digitalWrite(42,LOW);//B   digitalWrite(43,LOW);//A } void ninesecond(){   digitalWrite(37,LOW);//F   digitalWrite(38,LOW);//G   digitalWrite(39,HIGH);//E   digitalWrite(40,HIGH);//D   digitalWrite(41,LOW);//C   digitalWrite(42,LOW);//B   digitalWrite(43,LOW);//A } long distanceOverTime(long first,long second){  return ((first-second)/.1)*.0223693629;//taking cm/s to mph } long holder;//store the cm from last time through loop. long temp;//used to store the speed value after changes int counter; void loop() {   // establish variables for duration of the ping,   // and the distance result in inches and centimeters:   long duration, inches, cm;   int tens;   int ones;   long Speed;   // The sensor is triggered by a HIGH pulse of 10 or more microseconds.   // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:   pinMode(trigPin, OUTPUT);   digitalWrite(trigPin, LOW);   delayMicroseconds(2);   digitalWrite(trigPin, HIGH);   delayMicroseconds(10);   digitalWrite(trigPin, LOW);     // Read the signal from the sensor: a HIGH pulse whose   // duration is the time (in microseconds) from the sending   // of the ping to the reception of its echo off of an object.   pinMode(echoPin, INPUT);   duration = pulseIn(echoPin, HIGH);     // convert the time into a distance   inches = microsecondsToInches(duration);   cm = microsecondsToCentimeters(duration);   Speed=distanceOverTime(holder,cm);   holder=cm;//after speed caclulation so take the cm value for another calculation   Speed=abs(Speed);   if(Speed!=0 || counter==10){     temp=Speed;     counter=0;   }else{     counter++;   }   if(temp>=100){    zerofirst();    zerosecond();   }else{     ones=temp%10;     tens=temp/10;   }   if(ones == 0){     zerofirst();   }else if(ones==1){     onefirst();   }else if(ones==2){     twofirst();   }else if(ones==3){     threefirst();   }else if(ones==4){     fourfirst();   }else if(ones==5){     fivefirst();   }else if(ones==6){     sixfirst();   }else if(ones==7){     sevenfirst();   }else if(ones==8){     eightfirst();   }else if(ones==9){     ninefirst();   }   if(tens == 0){     zerosecond();   }else if(tens==1){     onesecond();   }else if(tens==2){     twosecond();   }else if(tens==3){     threesecond();   }else if(tens==4){     foursecond();   }else if(tens==5){     fivesecond();   }else if(tens==6){     sixsecond();   }else if(tens==7){     sevensecond();   }else if(tens==8){     eightsecond();   }else if(tens==9){     ninesecond();   }       Serial.print(inches);   Serial.print(" in, ");   Serial.print(cm);   Serial.print(" cm, ");   Serial.print(Speed);   Serial.print(" mph");   Serial.println();     delay(100); }   long microsecondsToInches(long microseconds) {   // According to Parallax's datasheet for the PING))), there are   // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per   // second).  This gives the distance travelled by the ping, outbound   // and return, so we divide by 2 to get the distance of the obstacle.   // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf   return microseconds / 74 / 2; }   long microsecondsToCentimeters(long microseconds) {   // The speed of sound is 340 m/s or 29 microseconds per centimeter.   // The ping travels out and back, so to find the distance of the   // object we take half of the distance travelled.   return microseconds / 29 / 2; } again, all your help and thought are appricated

Topic by herb1977 1 year ago  |  last reply 1 year ago


Is it true I need a 7448 chip if I'm using a common cathode 7 segment display?

At the moment, I have a 7447 decoder chip connected to a 7 segment display with two common ground connections on it. However, it's not working, and I read somewhere that you need a 7448 decoder chip to power a common cathode 7 segment display. Is that true?

Question by Ke-Bob 8 years ago  |  last reply 8 years ago


Do I need a BCD counter in making a 3 digit common anode 7 segment display? Answered

Help please

Question by cc67 7 years ago  |  last reply 7 years ago



Arduino connect 6 Digit 7 Segment LED Display

Hey guys, so I have been looking at various photo booths on Instructables and would love to create my own one using a Arduino and a Raspberry Pi. To get this in place i would like to know which Arduino can run this "rig". I will have 7 x 7 segment LEDs, Camera Remote to trigger camera, Raspberry Pi to receive, process print and show the images, printer to print the images(well this will be connected to the rPi, and a lcd to preview camera view before picture is taken. 2 Big buttons to trigger sequence and to print the last 4 photos onto 1 jumbo print. *NOTES* 6 of the 7 segments will be multiplexed for the top display. 1 x 7 segment will only count the amount of photos left (4-3-2-1-0) for every "session" LCD will be connected to the camera only for before snap preview. The press off a button will start the "session" The count down on the main display (6x7Segment) will go like 5 - 4 - 3 - Pose - Smile then the picture is taken. the single 7  segment will then go from 4 to 3 and the main display will start again from 5..... While this is running the LED in the button need to be off After all 4 photos has been taken the rPi need to get a signal to get the images (not sure how to do this either) process them en make them print ready. If the print button is pressed within 10 - 15 seconds the image will print out. ONLY WHEN THE BUTTON IS PRESSED.(This button will light up for this 10-15 seconds while the start button if off) All images need to stay on the device for later printing and saving on a disc. After the 10-15 seconds the first light need to come on again for next "session" I have no idea how to start this. Any help in this would be great. I am a wedding photographer with little to no knowledge in electronic circuits. But i know from reading (a lot this week) that i might need some extra parts to not damage the Arduino etc. Thanks in advance.

Topic by DragonzA 4 years ago  |  last reply 4 years ago


Ethernet.h causing problems with 7 segment display driver [Arduino]

Hey Instructables,  I have a really annoying issue with some Arduino code I am writing.  The code is for an ethernet controlled countdown timer.  In it's component parts the functions all work fine,  I can drive the 7 segment display fine. I can start/stop/set a count over Ethernet However as soon as I add the line  Ethernet.begin(mac, ip); in void setup()  The 7 segment display starts to show errors, specifically the first of the four digits. Even If I don't include any additional Ethernet related code in the loop, just calling the library on setup causes problems.  I'm not an especially experienced programmer so I'm really hoping someone can share a little of their wisdom here! #include #include          // needed for Arduino versions later than 0018 #include #include          // UDP library from: bjoern@cs.stanford.edu 12/30/2008 int digit1 = 11; //PWM Display pin 1 int digit2 = 10; //PWM Display pin 2 int digit3 = 9; //PWM Display pin 6 int digit4 = 6; //PWM Display pin 8 //Pin mapping from Arduino to the ATmega DIP28 if you need it //http://www.arduino.cc/en/Hacking/PinMapping int segA = A1; //Display pin 14 int segB = 3; //Display pin 16 int segC = 4; //Display pin 13 int segD = 5; //Display pin 3 int segE = A0; //Display pin 5 int segF = 7; //Display pin 11 int segG = 8; //Display pin 15 // Enter a MAC address and IP address for your controller below. // The IP address will be dependent on your local network: byte mac[] = {   0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; IPAddress ip(192, 168, 1, 177); unsigned int localPort = 8888;      // local port to listen on // buffers for receiving and sending data char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; //buffer to hold incoming packet, char ReplyBuffer[] = "acknowledged";       // a string to send back // An EthernetUDP instance to let us send and receive packets over UDP EthernetUDP Udp; elapsedMillis timeElapsed; //declare global if you don't want it reset every time loop runs //  milliseconds in a second unsigned int interval = 1000; unsigned int seconds = 0; unsigned int state = 1; unsigned int timeSetting = 10; unsigned int oldSeconds = 0; char theCount[9] = "01:06:30"; int secs = 0; int mins = 0; int hours = 0; String isItTime = ""; String firstFour = ""; void setup() {                      Ethernet.begin(mac, ip);   Udp.begin(localPort);      pinMode(segA, OUTPUT);   pinMode(segB, OUTPUT);   pinMode(segC, OUTPUT);   pinMode(segD, OUTPUT);   pinMode(segE, OUTPUT);   pinMode(segF, OUTPUT);   pinMode(segG, OUTPUT);   pinMode(digit1, OUTPUT);   pinMode(digit2, OUTPUT);   pinMode(digit3, OUTPUT);   pinMode(digit4, OUTPUT);     pinMode(13, OUTPUT);     } void loop() {     displayNumber(millis()/1000);    } void displayNumber(int toDisplay) { #define DISPLAY_BRIGHTNESS  500 #define DIGIT_ON  HIGH #define DIGIT_OFF  LOW   long beginTime = millis();   for(int digit = 4 ; digit > 0 ; digit--) {     //Turn on a digit for a short amount of time     switch(digit) {     case 1:       digitalWrite(digit1, DIGIT_ON);       break;     case 2:       digitalWrite(digit2, DIGIT_ON);       break;     case 3:       digitalWrite(digit3, DIGIT_ON);       break;     case 4:       digitalWrite(digit4, DIGIT_ON);       break;     }     //Turn on the right segments for this digit     lightNumber(toDisplay % 10);     toDisplay /= 10;     delayMicroseconds(DISPLAY_BRIGHTNESS); //Display this digit for a fraction of a second (between 1us and 5000us, 500 is pretty good)     //Turn off all segments     lightNumber(10);     //Turn off all digits     digitalWrite(digit1, DIGIT_OFF);     digitalWrite(digit2, DIGIT_OFF);     digitalWrite(digit3, DIGIT_OFF);     digitalWrite(digit4, DIGIT_OFF);   }   while( (millis() - beginTime) < 10) ; //Wait for 20ms to pass before we paint the display again } //Given a number, turns on those segments //If number == 10, then turn off number void lightNumber(int numberToDisplay) { #define SEGMENT_ON  LOW #define SEGMENT_OFF HIGH   switch (numberToDisplay){   case 0:     digitalWrite(segA, SEGMENT_ON);     digitalWrite(segB, SEGMENT_ON);     digitalWrite(segC, SEGMENT_ON);     digitalWrite(segD, SEGMENT_ON);     digitalWrite(segE, SEGMENT_ON);     digitalWrite(segF, SEGMENT_ON);     digitalWrite(segG, SEGMENT_OFF);     break;   case 1:     digitalWrite(segA, SEGMENT_OFF);     digitalWrite(segB, SEGMENT_ON);     digitalWrite(segC, SEGMENT_ON);     digitalWrite(segD, SEGMENT_OFF);     digitalWrite(segE, SEGMENT_OFF);     digitalWrite(segF, SEGMENT_OFF);     digitalWrite(segG, SEGMENT_OFF);     break;   case 2:     digitalWrite(segA, SEGMENT_ON);     digitalWrite(segB, SEGMENT_ON);     digitalWrite(segC, SEGMENT_OFF);     digitalWrite(segD, SEGMENT_ON);     digitalWrite(segE, SEGMENT_ON);     digitalWrite(segF, SEGMENT_OFF);     digitalWrite(segG, SEGMENT_ON);     break;   case 3:     digitalWrite(segA, SEGMENT_ON);     digitalWrite(segB, SEGMENT_ON);     digitalWrite(segC, SEGMENT_ON);     digitalWrite(segD, SEGMENT_ON);     digitalWrite(segE, SEGMENT_OFF);     digitalWrite(segF, SEGMENT_OFF);     digitalWrite(segG, SEGMENT_ON);     break;   case 4:     digitalWrite(segA, SEGMENT_OFF);     digitalWrite(segB, SEGMENT_ON);     digitalWrite(segC, SEGMENT_ON);     digitalWrite(segD, SEGMENT_OFF);     digitalWrite(segE, SEGMENT_OFF);     digitalWrite(segF, SEGMENT_ON);     digitalWrite(segG, SEGMENT_ON);     break;   case 5:     digitalWrite(segA, SEGMENT_ON);     digitalWrite(segB, SEGMENT_OFF);     digitalWrite(segC, SEGMENT_ON);     digitalWrite(segD, SEGMENT_ON);     digitalWrite(segE, SEGMENT_OFF);     digitalWrite(segF, SEGMENT_ON);     digitalWrite(segG, SEGMENT_ON);     break;   case 6:     digitalWrite(segA, SEGMENT_ON);     digitalWrite(segB, SEGMENT_OFF);     digitalWrite(segC, SEGMENT_ON);     digitalWrite(segD, SEGMENT_ON);     digitalWrite(segE, SEGMENT_ON);     digitalWrite(segF, SEGMENT_ON);     digitalWrite(segG, SEGMENT_ON);     break;   case 7:     digitalWrite(segA, SEGMENT_ON);     digitalWrite(segB, SEGMENT_ON);     digitalWrite(segC, SEGMENT_ON);     digitalWrite(segD, SEGMENT_OFF);     digitalWrite(segE, SEGMENT_OFF);     digitalWrite(segF, SEGMENT_OFF);     digitalWrite(segG, SEGMENT_OFF);     break;   case 8:     digitalWrite(segA, SEGMENT_ON);     digitalWrite(segB, SEGMENT_ON);     digitalWrite(segC, SEGMENT_ON);     digitalWrite(segD, SEGMENT_ON);     digitalWrite(segE, SEGMENT_ON);     digitalWrite(segF, SEGMENT_ON);     digitalWrite(segG, SEGMENT_ON);     break;   case 9:     digitalWrite(segA, SEGMENT_ON);     digitalWrite(segB, SEGMENT_ON);     digitalWrite(segC, SEGMENT_ON);     digitalWrite(segD, SEGMENT_ON);     digitalWrite(segE, SEGMENT_OFF);     digitalWrite(segF, SEGMENT_ON);     digitalWrite(segG, SEGMENT_ON);     break;   case 10:     digitalWrite(segA, SEGMENT_OFF);     digitalWrite(segB, SEGMENT_OFF);     digitalWrite(segC, SEGMENT_OFF);     digitalWrite(segD, SEGMENT_OFF);     digitalWrite(segE, SEGMENT_OFF);     digitalWrite(segF, SEGMENT_OFF);     digitalWrite(segG, SEGMENT_OFF);     break;   } }

Topic by drkovorkian 4 years ago  |  last reply 4 years ago


WE HAVE INSTALLED A 7 SEGMENT BOARD TO SHOW SOME DATA. BUT IT IS NOT VISIBLE IN SUNLIGHT? PLEASE HELP

7 SEGMENT DIGITAL BOARD HAVE BEEN INSTALLED IN OUR FACILITY. WE HAVE GIVEN 12 VOLT POWER SUPPLY FOR THESE DIGITS. ITS FACE IS TOWARDS SUNLIGHT. THESE DIGITS ARE NOT VISIBLE DURING DAY LIGHT. PLEASE HELP ME WHAT TO DO

Question by muhammad bin qasim 6 years ago  |  last reply 6 years ago


Can I run multiple 7 Segment 4 digit displays with an Arduino Uno?

Is it possible to run five clock displays with different times on them using an Arduino Uno? I'd like to make a wall schedule where the times are static but change each day based on the program I write, but I can't find any tutorials to help me figure out how to do this.

Question by WJJess 1 year ago


how to make tachometer with 7 segment display for single cylinder 2 stroke 6v ignition..can anyone help me? Answered

I found a diy project from https://www.instructables.com/image/FU19QM5GH4NN2QX/Building-the-circuit.jpg but i want to use only 3 led(7-segment display) instead  of  4 led.. and another problem is this circuit only fit input signal from 12v ignition 4 cylinder ( car ), but mine is 6v single cylinder 2-stroke( motorcycle ).. what i have to modify so than i can make a circuit that can use 6v signal to the ic and only use 3 led(7-segment display.. can any give an opinion or some one that have done this to help..im not to good with electronic but i understand english. :-)

Question by kill_them_now 7 years ago  |  last reply 7 years ago


Where can I find large seven segment displays?

My neighbor wants me to make a scoreboard for his ping pong table, but I'm having difficulty finding something to use as the display.  Seeed Studio has some, http://www.seeedstudio.com/depot/7-Segment-Display-8-Inches-Red-p-1194.html, but they come in individual segments.  Sparkfun has some as well, but they're on a tan colored PCB.  Where's the cheapest place to find 6"+ displays on a black background?

Question by furrysalamander 4 years ago  |  last reply 4 years ago


system that takes BCD inputs from DIP Switches and display Decimal on 7-Segment display, without using any BCD Decoder?

Hi i want to make system that takes BCD inputs from DIP Switches and display Decimal on two 7-Segment display, without using any BCD Decoder.what ic should i choose??and circuit.

Question by szafar2 4 years ago  |  last reply 4 years ago


A brighter speedometer? LED display?

My current speedometer uses the same type of display that you may find on a solar-activated calculator or cheap alarm clock (the ones that display black letters on a grey background). problem is, I cant see it in bright sunlight! Is there is a way to make a speedometer with my own set of 7-segments displays that use LEDs, or if I could convert my current one to using them?

Question by phephq 8 years ago  |  last reply 8 years ago


Can any one help me make a random # genorator?

Can anyone help me with an idea.. I want to make an Arduino Duemilanove random number genorator that will show up on 2 7-segments when I press a button. Any code suggestions, or help will be nice and if I ever make a instructable of it I will thank you all. Thanks!? I want help with a random # generator that will appear on 2 LED 7-segments, and will activate on the push of a button.

Question by chrisapalo 9 years ago  |  last reply 9 years ago


Circuit for 8 bit number to BCD?

For a TTL project I'm working on, I wanted to have 7 segment display output for the 8 bit numbers it works with. After searching on google and not finding very well documented circuits, I decided to ask here. Because the input is 8 bit, it should output 3 numbers. I only need the circuit to do the BCD because I can use 7 segment display drivers from there. (Like a 7446 IC) Thank you.

Question by Super_Nerd 5 years ago  |  last reply 3 years ago


Breadboard (again)

These are some new pics of my breadboard circuits. I also have figured out how to wire my 7 segment LED.

Topic by DELETED_Nicker987 11 years ago  |  last reply 11 years ago


How should I build a digital "counter with a seven-segment display?

I have a seven segment LED display and I would like to build a digital counter that will increase or decrease the number value displayed on the display when I press a button (a button for counting up and a button for counting down). So I would like to be able to press one button to increase the displayed value (1, 2, 3...) and then press a different button and have the value decrease (9, 8, 7...). Thanks for the help!

Question by MadMechanic 9 years ago  |  last reply 6 years ago


does anybody know how to make an IR frequency reader?

Does anybody know how to make an IR frequency reader by com port? or a 7-segment? or with a digital multimeter? P.S: Most likely to me with a digital multimeter.

Question by top.boy 7 years ago  |  last reply 7 years ago


Can someone please help me create a simple 7-segment number display? [see below for details]

Background info : My name is Simon. I'm a member of the Classic Celica Club of Victoria (Australia) that competes in an anual event called the Winton 6hr Regularity Relay. It's a 6 hour long track event with about 40 teams and 6 cars per team. Each team has one car on the track for the 6 hours. Prior to the race, each car nominates a time that they believe they can consistently do for their share of the race (usually approx. an hour each). Points are awarded for each lap achieved that is within 1 second of the nominated time. Points are deducted for any lap that is faster than the nominated time. The thing is THE DRIVERS CANNOT CARRY ANY FORM OF TIMING DEVICE IN THE CAR. The aim : To build a board that clearly displays a 3 digit time. (eg: 1min 56sec).  Team members will time the car on the track and then use the board to display the time for the driver to read as they pass by the pit wall.  (note: this practice is not against the rules). The requirements : The board must be big enough, and clear enough, to be read from >75m away. The adjustment of the board must be very quick and intuitive. (the task of timing is shared around and there's no time to train people to use the device). The board must be light enough to be held by outstretched arms. No timing device is required in the board itself. The time displayed on the board isn't always the time that is recorded. Adjustments are sometimes made for one reason or another. Scrolling through the numbers is fine, so long as you can scroll both up and down. Each digit should be completely individual (ie: not linked). Layout : [see attached images] I was thinking of using a typical 7-segment display layout made up of 79 x 10mm LEDs. The actual physical construction of the board is well within my ability. It's all the circuitry that i am clueless on.  I am a total newbie so please be gentle when describing electronics. I'm new to instructables but i have spent quite a few hours searching this site for answers. The thing i've found is that my device is far simpler than anything posted on here but i'm still too much of a newb to work out how to do it. ps: I hope i have posted in the correct section. Simon.

Question by Si Mo 9 years ago  |  last reply 9 years ago


diode logic

I'm making a giant adding machine using only resistors(miscellaneous), switches SPST (for input) LEDs (for display) and diodes(for logic). NO TRANSISTORS I have it so that it can recognize 0,1,2,3,4,5,6,7,8,9, but if it recognizes 8, then it recognizes it as all the other numbers. If it recognizes 0, it recognize 1, and 7. If it recognizes 6 it recognizes 1, and 5. If it recognize 9 it also recognize 7. If it recognizes 3, it also recognizes 7. basically if you take a 7 segment display, any number on it, it'll recognize all the numbers in the number. I need help sorting it ou so that if it recognizes 8, it only recognizes 8. If it recognizes 3, it only recognizes 3. Etc...

Topic by guyfrom7up 11 years ago  |  last reply 7 years ago


How can i make an up/down counter with arduino?

I would like some help making a 2 digit up/down counter with arduino that resets to a preset-able number and how to connect it to a 2 digit 7-segment display, all responses are appreciated.

Question by BBru62 7 years ago  |  last reply 7 years ago


Circuit for digital time control

In my design classroom project, my students want to build a 230V AC electric immersion heater (for heating water in a bucket) whose duration of heating the user should be able to set. The user should be able to set the ON duration by pressing up- and down- keys (operating 2 switches) to increase or decrease numbers that show on a dual 7-segment display (for showing 1-99). The numbers that show in the 7-segment display is the time in minutes the heater should stay on for and then switch itself off. Please guide me to a circuit that would do the above. All our induction cookers, washing machines, etc have this interface, I know this is not something new, but not being an electronics person I don't know where and with what terminology to look. Please help.

Question by ranjit_k 2 years ago  |  last reply 2 years ago


Screen to use for HUD in goggles?

I'm using a GPS module and Arduino to make a Heads Up Display for a pair of old ski goggles I have. What kind of display can I use to show my speed? I just need two digits (but 2 7-Segment LEDs would probably be too thick). Any suggestions are welcome!

Topic by Login258 10 years ago  |  last reply 7 years ago


Problems with the 4511b IC chip??

SO i made a circuit which is a binary adder(using the 4008b) that adds numbers in binary and then passes on the result to a 4511 IC(its a BCD to 7 segment decoder),so basically it adds numbers in binary and displays them in decimal .It seemed to work fine for a while but then suddenly when i tried adding 0011 +0001(3+1) in binary ,it still displayed 0 and then i tried tapping the battery for a second or two and then suddenly the seven segment display shows 4 .The circuitry is all fine and right .but do i have to connect latch enable(pin 5) pin of the Ic?.Both the IC's run on a 9v battery and for the 4511 decoder IC i used 33k pull down resistor .Is my pull down resistor value for the 4511 IC too high ?The binary adder part seems to work very well,its the bcd to 7 segment decoder IC part that I'm very much concerned about.Is there too less power for both the chips to run on?I've not got a single idea at all .so, >PLS help me if you can.

Question by Strontium 5 years ago  |  last reply 5 years ago


How a Transistor connected to 12v and out 4.7v !!!!!!? Answered

Hello All, I have a problem with a circuit i am building, I use a 2N2222 transistor to drive a Common Cathode big 7 Segment  with a 595 shift register.. I connected a 12v to Emitter, the collector out a 4.7 volts !! How is this possible ? could some one explain please ? Thanks all

Question by EZELab 7 years ago  |  last reply 7 years ago


Simplest way to build a stopwatch (max 59 minutes and 59 seconds i.e, 59:59) without coding or programmable ics?

Hi,    I am trying to make a stopwatch that counts from 1 second to 59 minutes. Almost all the circuits that I've seen involves some kind of coding or programmable ics. But I don't want that. I'll be using a quartz crystal as my 1 Hz base and 4 individual 7 segment displays ( 2 for seconds and 2 for minutes). I know how to use decade counters to count till 60 seconds but I need help for turning 60 seconds to 1 minute and reset the 7 segments that represent seconds. In a nutshell, I would like to know how to change 00:59 to 01:00.  A counter that updates after every six "inputs" could solve everything. A link to a a circuit diagram would be helpful too.

Question by Adarsh_tronix 2 years ago  |  last reply 2 years ago


Problems with my arduino mini shield

So i built an arduino mini shield for displaying numbers(i used the 4511 bcd to 7 segment decoder ic ) using only 4 pins excluding v+ and v-(power).It seemed to work well for while but later when i tried displaying 0001 ( 1 in binary) ,it suddenly stopped working or some all the segments got dimly lit . .Also if i plug it into the breadboard and connect some jumpers to the pins of the arduino(+5v and gnd) ,it seems to work fine,however when i plug it directly into the arduino,setting pin13 high and the gnd pin near it ,it does'nt work properly and all the segments glow dimly.The control pins for the digits are pin 12,11,10 and 9.also when i plug it into the breadboard and instead of connecting the pins with jumpers to +5v and gnd of the arduino,if i connect it to pin 13(HIGH) and the gnd near it it displays only 8, also can't i use pin 13 being HIGH as 5v' s? WHAT AM  I SUPPOSED TO DO?

Question by Strontium 5 years ago  |  last reply 5 years ago


Dear Instructables, how would i go about creating a 3 digit up counter that reacted to 3 buttons of different values?

Basically i'm designing and making a scoreboard for a rugby match for an a-level course. I'll explain the buttons of different values first, in rugby (for those who don't know) there are 3 different ways that the score can increase 2 points (conversion), 3 points (penalty, drop goal) and 5 points (try). I already know how to make a circuit to increase in 1's but i wasn't sure if you could do it with 3 different values in the same circuit. I was thinking of using a 4024 seven bit counter connected to a bcd to led decoder then to 7 segment led displays. is there anything out there which could make my job easier or do you have any advice or could you help me? Thanks alot, Hrimiller Edit: 4024 seven bit counter connected to a bcd to led decoder then to 7 segment led displays

Question by hrimiller 6 years ago  |  last reply 6 years ago


Change a 7 seg display from CC to CA in code? Answered

I am not as familiar with C/C++ as i am with Arduino. I am wanting to change this code from Common Cathode to Common Anode. How can i do this? //_____________________ fuse.c #define F_CPU 8000000UL #include #include #include #include #include #define _REVERSE #define _OPT_BUTTON_ /* . document tab-stop set to 4, best viewed w/ vi set to ":set ts=4" . description   this project is created so that if i could revert the RESET fuse change and flash via   SPI again. . features   . reads device signature and hi-low fuses for hi-voltage serial programmable attinys   . reset hi-low fuses to factory default on target devices   . layout to drop-on attiny13, attiny25/45/85 8 pin devices targets   . attiny24/44/84 targets needs additional breadboard and jumper wires   . standalone operations, fuses show on 7 segment display . project fuse setting   avrdude -c usbtiny -p t2313 -V -U lfuse:w:0xe4:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m . parts list   . attiny2313   . 4x7 segment LED display   . 1k resistor x 2   . 2n2222 NPN transistor or equivalent   . 78L05   . mini breadboard 170 tiepoints   . +12V battery source . opearation   . place 8 pin target device on breadboard   . for 14 pin targets, jumper wire to breadboard   . apply 12V power   . display shows device name upon identification   . press and release button to cycle display content   . displays device name, fuse hi bits, fuse low bits and fuse extended bits   . long press and release button to reset fuse to factory default   . references and related projects   . datasheets   . avrdoper http://www.obdev.at/avrusb/avrdoper.html/   . mightyohm http://www.mightyohm.com/blog/2008/09/arduino-based-avr-high-voltage-programmer/                  Gd 12V                  Gd Rt V+ Ck MI MO (tinyusb programmer)                   +  +  +  +  +  +    +=====================================================+    |  .  .  .  .  .  I  .  .  .  .  .  .  .  .  .  .  .  | [I]n (78L05)    |  .  .  .  .  C  .  .  .  .  .  .  .  .  .  .  .  .  | [C]ommon    |  .  .  .  .  .  .  O  .  .  .  .  .  .  .  .  .  .  | [O]ut    | (v)(d)(b)(c) +--------o (v) .  .  .  .  . (d)(c) .  |    |  +--+--+--+  |  o  +--+-(1)-A--F-(2)(3)-B--+--+  .  |    | |+         | 1k | |+ b7..6..5..4..3..2..1..0 d6|    |    | |         -| |  1k|R d0..1 a1..0 d2..3..4..5  -|    |    |  +--+--+--+  o  |  +--+--+--+--+--+--+--+--+--+  .  |    |  .  .  .  .  .  o  -  -  E  D (.) C  G (4) -  -  .  |    |  o--------------o  .  .  .  .  .  .  .  .  .  .  .  |    |  . (a) .  E  B  C  . (a) .  .  .  .  .  . (b) .  .  | EBC of 2n2222    |  .  .  .  .  .  .  .  .  .  .  .  .  .  o--B--o  .  |    +=====================================================+                     (p)(p)                                 join (p)(p) during programming       SDO   SDI     +--+--+--+    |+    SII  |    |R        -|     +--+--+--+       SCI #define HIV _BV(7) //b7 .. RESET #define VCC _BV(6) //b6 .. (v) #define SDO _BV(0) //b0 .. (d) #define SCI _BV(0) //d0 .. (a) #define SII _BV(5) //d5 .. (b) #define SDI _BV(6) //d6 .. (c) */ #define BUTTON_DDR   DDRD #define BUTTON_PORT  PORTD #define BUTTON_PIN   _BV(4) #define SEG_A_PB _BV(5) #define SEG_B_PB _BV(1) #define SEG_C_PB 0x00 #define SEG_D_PB 0x00 #define SEG_E_PB 0x00 #define SEG_F_PB _BV(4) #define SEG_G_PB 0x00 #define SEG_d_PB 0x00 #define DIGIT_0_PB _BV(6) #define DIGIT_1_PB _BV(3) #define DIGIT_2_PB _BV(2) #define DIGIT_3_PB 0x00 #define SEG_A_PD 0x00 #define SEG_B_PD 0x00 #define SEG_C_PD _BV(2) #define SEG_D_PD _BV(7)  // d.7 maps to a.1 #define SEG_E_PD _BV(1) #define SEG_F_PD 0x00 #define SEG_G_PD _BV(3) //#define SEG_d_PD 0x00 #define SEG_d_PD _BV(6)  // d.6 maps to a.0 #define DIGIT_0_PD 0x00 #define DIGIT_1_PD 0x00 #define DIGIT_2_PD 0x00 #define DIGIT_3_PD _BV(4) #ifdef _REVERSE #define HOLD_DDR_VAL 0x60 #define HOLD_VAL   0x40 #else #define HOLD_DDR_VAL 0x18 #define HOLD_VAL   0x08 #endif #define SEGS_STAY(v) \    (((v & _BV(6)) ? 1 : 0) +\ ((v & _BV(5)) ? 1 : 0) +\ ((v & _BV(4)) ? 1 : 0) +\ ((v & _BV(3)) ? 1 : 0) +\ ((v & _BV(2)) ? 1 : 0) +\ ((v & _BV(1)) ? 1 : 0) +\ ((v & _BV(0)) ? 1 : 0)) | 0x40 #define SEGS_PORT_DET(p, v) \    (((v & _BV(6)) ? SEG_A_P##p : 0) | \ ((v & _BV(5)) ? SEG_B_P##p : 0) | \ ((v & _BV(4)) ? SEG_C_P##p : 0) | \ ((v & _BV(3)) ? SEG_D_P##p : 0) | \ ((v & _BV(2)) ? SEG_E_P##p : 0) | \ ((v & _BV(1)) ? SEG_F_P##p : 0) | \ ((v & _BV(0)) ? SEG_G_P##p : 0)) #define SEGS_PORT(v) {SEGS_STAY(v),SEGS_PORT_DET(B, v),SEGS_PORT_DET(D, v)} #define SEGS_B (SEG_A_PB|SEG_B_PB|SEG_C_PB|SEG_D_PB|SEG_E_PB|SEG_F_PB|SEG_G_PB|SEG_d_PB) #define SEGS_D (SEG_A_PD|SEG_B_PD|SEG_C_PD|SEG_D_PD|SEG_E_PD|SEG_F_PD|SEG_G_PD|SEG_d_PD) #define DIGITS_B (DIGIT_0_PB|DIGIT_1_PB|DIGIT_2_PB|DIGIT_3_PB) #define DIGITS_D (DIGIT_0_PD|DIGIT_1_PD|DIGIT_2_PD|DIGIT_3_PD) #define USED_B (SEGS_B|DIGITS_B) #define USED_D (SEGS_D|DIGITS_D) /*        ___a__       |      |      f|      | b        ___g__      e|      | c       |      |        ___d__ */ //_____________________ abc defg #define LTR_0 0x7e // 0111 1110 #define LTR_1 0x30 // 0011 0000 #define LTR_2 0x6d // 0110 1101 #define LTR_3 0x79 // 0111 1001 #define LTR_4 0x33 // 0011 0011 #define LTR_5 0x5b // 0101 1011 #define LTR_6 0x5f // 0101 1111 #define LTR_7 0x70 // 0111 0000 #define LTR_8 0x7f // 0111 1111 #define LTR_9 0x7b // 0111 1011 #define LTR_A 0x77 // 0111 0111 #define LTR_b 0x1f // 0001 1111 #define LTR_C 0x4e // 0100 1110 #define LTR_d 0x3d // 0011 1101 #define LTR_E 0x4f // 0100 1111 #define LTR_F 0x47 // 0100 0111 #define LTR_P 0x67 // 0110 0111 #define LTR_G 0x5e // 0101 1110 #define LTR_n 0x15 // 0001 0101 #define LTR_r 0x05 // 0000 0101 #define LTR_t 0x0f // 0000 1111 #define LTR__ 0x00 // 0000 0000 uint8_t EEMEM digit2ports[][3] = { SEGS_PORT(LTR_0), SEGS_PORT(LTR_1), SEGS_PORT(LTR_2), SEGS_PORT(LTR_3), SEGS_PORT(LTR_4), SEGS_PORT(LTR_5), SEGS_PORT(LTR_6), SEGS_PORT(LTR_7), SEGS_PORT(LTR_8), SEGS_PORT(LTR_9), SEGS_PORT(LTR_A), SEGS_PORT(LTR_b), SEGS_PORT(LTR_C), SEGS_PORT(LTR_d), SEGS_PORT(LTR_E), SEGS_PORT(LTR_F), SEGS_PORT(LTR_r), SEGS_PORT(LTR_P), SEGS_PORT(LTR_G), SEGS_PORT(LTR_n), SEGS_PORT(LTR_t), SEGS_PORT(LTR__), }; enum { POS_0, POS_1, POS_2, POS_3, POS_4, POS_5, POS_6, POS_7, POS_8, POS_9, POS_A, POS_b, POS_C, POS_d, POS_E, POS_F, POS_r, POS_P, POS_G, POS_n, POS_t, POS__, }; #define ST_HOLD  0x80 #define ST_PRESSED 0x40 #define ST_BUTTON   (ST_HOLD|ST_PRESSED) #define ST_TICKED 0x20 #define ST_12HR  0x10 #define ST_REFRESH 0x08 #define ST_BUZZ     0x04 #define ST_SETUP    0x03 #define ST_SENSE ST_BUZZ volatile uint8_t busy=0; volatile uint8_t state=ST_REFRESH|ST_12HR; volatile uint8_t dim=1; uint8_t  pos=0, stays; uint8_t  mode=0; #ifdef _OPT_SENSE_ uint16_t charged=0; #endif uint16_t button=0; uint16_t clicks=0, ticks=0; //_______________________ ticks per second and devired values #define TPS   (F_CPU/256) #define TPS_2 (TPS/2) #define TPS_4 (TPS/4) #define LONG_HOLD (TPS/3) #define NUM_DIGITS 4 static const uint8_t digit_mapb[] PROGMEM = { 0x40,0x08,0x04,0x00 }; static const uint8_t digit_mapd[] PROGMEM = { 0x00,0x00,0x00,0x10 }; //_________________ list of porta..c,ddra..c,stay * number_of_digits uint8_t output[3 * NUM_DIGITS]; uint8_t *ioptr = output; uint8_t dot = 0x00; //__________________________________________________ ISR(TIMER0_OVF_vect) { clicks++; if (clicks >= TPS) {   clicks = 0;   state |= ST_TICKED;   ticks++; }//if if (stays & 0x0f) { stays--; return; } stays >>= dim; DDRA  &= ~(USED_D>>6); DDRB  &= ~USED_B; DDRD  &= ~(USED_D&0x3f); PORTA &= ~(USED_D>>6); PORTB &= ~USED_B; PORTD &= ~(USED_D&0x3f); if (stays) { stays--; return; } if (busy) return; #ifdef _OPT_BUTTON_ //___________ scan button PORTD |= BUTTON_PIN; _delay_us(1);  // allow pull-up to settle if (PIND & BUTTON_PIN) {   if (button) {    if (button > 30) {     //_________ released     if (button > LONG_HOLD)      state |= ST_HOLD;     else      state |= ST_PRESSED;     stays = 0x14;    }//if   }//if   else {    stays = 0x10;   }//else   button = 0; }//if else {   //_____________ pressed   button++;   if (button > LONG_HOLD) { // show long hold #ifdef _REVERSE    DDRB |= HOLD_DDR_VAL; PORTB |= HOLD_VAL; #else    DDRD |= HOLD_DDR_VAL; PORTD |= HOLD_VAL; #endif   }//if }//else PORTD &= ~BUTTON_PIN; DDRD  &= ~(USED_D&0x3f); PORTD &= ~(USED_D&0x3f); if (state & ST_BUTTON) return; if (button) return; #endif #ifdef _OPT_SENSE_ if (!charged && (state & ST_SENSE)) {   state &= ~ST_SENSE;   DDRB  = 0x00; PORTB = 0x00;   DDRD  = 0x00; PORTD = 0x00;   _delay_us(1);   //_________ charge sensor led   charged = 1;   //SENSE_CHARGE   DDRA  |=  SEGS_D>>6;   PORTA &= ~(SEGS_D>>6);   DDRB  |=  SEGS_B;   PORTB &= ~SEGS_B;   DDRD  |=  SEGS_D&0x3f;   PORTD &= ~(SEGS_D&0X3f);   DDRB  &= ~0x44;   PORTB |=  0x44;   //DDRB  &= ~_BV(6);   //PORTB |= _BV(6);   //_delay_us(1);   //asm volatile("nop\n\tnop\n\tnop\n\tnop\n\t"::);   //asm volatile("nop\n\tnop\n\tnop\n\tnop\n\t"::);   //asm volatile("nop\n\tnop\n\tnop\n\tnop\n\tnop\n\t"::);   //while (!SENSE_BUTT);   //PORTB &= ~_BV(6);   while (!SENSE_ALL);   PORTB &= ~0x44;   return; }//if #endif //___________ load segments uint8_t portd = *ioptr++; uint8_t portb = *ioptr++; uint8_t porta = portd >> 6; portd &= 0x3f; //uint8_t mapb = digit_mapb[pos]; //uint8_t mapd = digit_mapd[pos]; uint8_t mapb = pgm_read_byte(&digit;_mapb[pos]); uint8_t mapd = pgm_read_byte(&digit;_mapd[pos]); DDRA  |= porta; DDRB  |= portb | mapb; DDRD  |= portd | mapd; #ifdef _REVERSE PORTA |= ~porta; PORTB |= ~portb & mapb; PORTD |= ~portd & mapd; #else PORTA |= porta; PORTB |= portb & ~mapb; PORTD |= portd & ~mapd; #endif stays  = *ioptr++; if (stays && (state & ST_SETUP) && (clicks / TPS_2) &&   ((pos == (state & ST_SETUP)) ||   (!pos && !(state & 0x02))))   stays = 0x08; pos++; if (pos >= 4) {   pos = 0;   ioptr = output; }//if } //__________________________________________________ void seg2port(uint8_t bcd, uint8_t which) { if (which & 0x40) {   //_____________ bcd entry, do 2nd digit 1st, then 1st digit   which &= 0x0f;   seg2port(bcd&0x0f, which+1);   bcd >>= 4; }//if uint8_t *pp = output + which * 3; uint8_t offset = 3; busy++; do {   *pp++ = eeprom_read_byte(&digit2ports;[bcd][--offset]); } while (offset); busy--; } #define HIV _BV(7) //b7 #define VCC _BV(6) //b6 #define SDO _BV(0) //b0 #define SCI _BV(0) //d0 #define SII _BV(5) //d5 #define SDI _BV(6) //d6 #define SCI_PULSE _delay_us(1); PORTD |= SCI; _delay_us(1); PORTD &= ~SCI; //__________________________________________________ uint8_t hv_cmd(uint8_t *dptr, uint8_t cnt) { // data format is like write 0_DDDD_DDDD_00 //                      read D_DDDD_DDDx_xx uint8_t sdo=0x00; while (cnt) {   uint8_t sdi = *dptr++;   uint8_t sii = *dptr++;   uint8_t cmp=0x80;   sdo = 0x00;   PORTD &= ~(SDI|SII);   SCI_PULSE;   //sdo = ((PINB&SDO;) ? 1 : 0);   //sdo = ((PINB&SDO;) ? 0 : 1);   // 0x1e92 06   // 0x62df b0110 0010 1101 1111   while (cmp) {    sdo <<= 1;    //sdo |= ((PINB&SDO;) ? 0 : 1);    //sdo |= ((PINB&SDO;) ? 1 : 0);    if (PINB&SDO;) sdo |= 0x01;    PORTD &= ~(SDI|SII);    if (cmp&sdi;) PORTD |= SDI;    //else         PORTD &= ~SDI;    if (cmp&sii;) PORTD |= SII;    //else         PORTD &= ~SII;    SCI_PULSE;    //sdo |= (PINB&SDO;) ? 1 : 0;    cmp >>= 1;   }//while   PORTD &= ~(SDI|SII);   SCI_PULSE;   SCI_PULSE;   _delay_us(100);   cnt--; }//while //sdo = cnt; return sdo; } uint8_t chip_sig[] = { 0xee, 0xee, 0xee, 0xee, 0x00, 0x00 }; //__________________________________________________ void read_chip(uint8_t release_reset) { cli(); busy++; // enter hv mode, everything go low DDRB  |= (VCC|HIV|SDO); PORTB &= ~(VCC|SDO);// Vcc and data out off PORTB |= HIV;  // 12v off DDRD  |= (SCI|SDI|SII); PORTD &= ~(SCI|SDI|SII); //_delay_ms(50); PORTB |= VCC;  // Vcc on _delay_us(40); PORTB &= ~HIV;  // turn on 12v _delay_us(15); DDRB  &= ~SDO;  // release SDO _delay_us(300); // should be ready to issue commands // read signature // // default fuse settting taken from http://www.engbedded.com/fusecalc/ // // mcu - id          - factory fuse low-high-extended // t13 - 1e9007 (07) - 6a-ff // t25 - 1e9108 (18) - 62-df-ff // t45 - 1e9206 (26) - 62-df-ff // t85 - 1e930b (3b) - 62-df-ff // t24 - 1e910b (1b) - 62-df-ff // t44 - 1e9207 (27) - 6a-df-ff // t84 - 1e930c (3c) - 6a-df-ff // signature  { 0x08, 0x4c, 0xpp, 0x0c,      0x00, 0x68,      0x00, 0x6c // write fuse { 0x40, 0x4c, val,  0x2c,      0x00, 0x64/0x74, 0x00, 0x6c/0x7c // read fuse  { 0x04, 0x4c, 0x00, 0x68/0x7a, 0x00, 0x6c/0x7c uint8_t cmd[] = { 0x08, 0x4c, 0x00, 0x0c, 0x00, 0x68, 0x00, 0x6c, }; uint8_t *pdata = chip_sig; uint8_t i; //____________________ read device signature for (i=0;i<3;i++) {   cmd[2] = i;   if (i)    *pdata++ = hv_cmd(&cmd;[2], 3);   else    *pdata++ = hv_cmd(cmd, 4); }//for uint8_t  id[] = { 0x07, 0x18, 0x26, 0x3b, 0x1b, 0x27, 0x3c, }; uint8_t mcu[] = { 0x13, 0x25, 0x45, 0x85, 0x24, 0x44, 0x84, }; if ((chip_sig[0] == 0x1e) && ((chip_sig[1]&0xf0) == 0x90) &&   !(chip_sig[2]&0xf0)) {   chip_sig[1] <<= 4;   chip_sig[1] |= chip_sig[2];   /*   switch (chip_sig[1]) {    case 0x07: chip_sig[1] = 0x13; break;    case 0x18: chip_sig[1] = 0x25; break;    case 0x26: chip_sig[1] = 0x45; break;    case 0x3b: chip_sig[1] = 0x85; break;    case 0x1b: chip_sig[1] = 0x24; break;    case 0x27: chip_sig[1] = 0x44; break;    case 0x3c: chip_sig[1] = 0x84; break;    default: chip_sig[1] = 0xee; break;   }//switch   chip_sig[0] = 0x00;   */   for (i=0;i<7;i++) {    if (chip_sig[1] == id[i]) {     chip_sig[0] = i;     chip_sig[1] = mcu[i];    }//if   }//for   pdata--; }//if //____________________ reset fuse if (release_reset) {   cmd[0] = 0x40;   //________________ write fuse low bits   cmd[3] = 0x2c; cmd[5] = 0x64;   if (chip_sig[1] == 0x13 || chip_sig[1] == 0x44 || chip_sig[1] == 0x84)    cmd[2] = 0x6a;   else    cmd[2] = 0x62;   hv_cmd(cmd, 4); _delay_ms(50);   //________________ write fuse high bits   cmd[5] = 0x74; cmd[7] = 0x7c;   if (chip_sig[1] == 0x13)    cmd[2] = 0xff;   else    cmd[2] = 0xdf;   hv_cmd(cmd, 4); _delay_ms(50);   //________________ write fuse extended bits   if (chip_sig[1] != 0x13) {    cmd[5] = 0x66; cmd[7] = 0x6e;    cmd[2] = 0x01;    hv_cmd(cmd, 4); _delay_ms(50);   }//if }//if //____________________ read fuse cmd[0] = 0x04; cmd[2] = 0x00; cmd[3] = 0x68; cmd[5] = 0x6c;   // fuse low *pdata++ = hv_cmd(cmd, 3); cmd[3] = 0x7a; cmd[5] = 0x7c;   // fuse high *pdata++ = hv_cmd(cmd, 3); if (chip_sig[1] != 0x13) {   cmd[3] = 0x6a; cmd[5] = 0x6e;  // fuse extended   *pdata++ = hv_cmd(cmd, 3); }//if // done, turn things off PORTB |= HIV; PORTB &= ~(VCC|SDO); PORTD &= ~(SCI|SDI|SII); busy--; sei(); } uint8_t menu=0, loc=0; //__________________________________________________ void main(void) { TCCR0B |= 0x01; TIMSK  |= _BV(TOIE0); TCNT0   = 0x00; DDRA = PORTA = 0; DDRD = PORTD = 0; DDRB   = (VCC|HIV|SDO); //DDRB   = (VCC|SDO); PORTB  = HIV;  // 12v off _delay_ms(50); read_chip(0); sei(); while (1) {   //_____________ "state" bits LBTSRZPP   //              L - long hold, B - button, T - ticked, S - setup mode,   //              R - refresh,   Z - buzzer  PP - digit edit position   //   //_____________ "menu" bits TxxOxMMM   //              T   - in toggle mode   //              O   - option used   //              MMM - menu id (1-4)   if (state & ST_TICKED) {    state &= ~ST_TICKED;   }//if   if (state & ST_REFRESH) {    state &= ~ST_REFRESH;    dot = _BV(mode);    if (mode) {     seg2port(chip_sig[mode*2], 0x40);    }//if    else {     seg2port(POS__, 0);     seg2port(POS_t, 1);    }//else    seg2port(chip_sig[mode*2+1], 0x42);   }//if   //_____________________________________ check input   if (state & ST_BUTTON) { // needs attention    loc = 0;    if (state & ST_PRESSED) {     // normal pressed, rotate display mode     mode++;     if (mode >= 3) mode = 0;    }//if    else {     // pressed and held, reset fuse     mode = 0;     read_chip(1);     _delay_us(100);     read_chip(0);    }//else    state &= ~ST_BUTTON;    state |= ST_REFRESH;   }//if }//while }

Question by WWC 5 years ago  |  last reply 5 years ago


EL Wire and Paper watch!

Just thought of this! Has anyone ever tried to make a watch/clock using el wire? I thought of making a simple 7 seg led design with a paper (this modeling plasitc) cover/strap as a wrist watch... Get the insides of a 7 seg type led watch. Use electroluminescentwires instead of segments. Put the wires bhind a paper face which is designed as a single piece with strap. attach battery. BINGO! Only thing I've not been able to verify - need to use an el inverter for the display Anyone had any dealsing with this technology and can tell me about it.. meanwhile I'lll scour the instructables Thanks

Question by sParekh 10 years ago  |  last reply 10 years ago