Project: Seven Segment Display and an Arduino Mega

Seven Segment Display standing on a table

Everyone has one in their house, a clock on your VCR you never set, a timer on your cooker or your microwave, a digital clock. The seven segments of LEDs that light up to form numbers are made up of Seven Segment Displays.

There are all sorts of projects you might want to add these to, but this is a basic introduction with one number.

The pins on these displays may differ, on mine, the first pin did nothing and the middle pin on the top and bottom connected to ground. Each of the other pins was a positive for a different segment on the display.

Seven Segment Display in Breadbord

First things first, look up the data sheet of your display and figure out how much current and voltage it should take, no point burning it out. You will probably need to hook up a resister for safety.

I’m using an Arduino Mega, but you could do it with any Arduino boards or a Raspberry Pi.

Put the display in a breadboard so each pin can be powered separately and first wire up the ground with a resister, then connect it to the Arduino ground.

Then, connect a jumper line to the 3.5V on the Arduino and connect it to each pin on the Display in turn. If everything works, each segment should light up as you power it up.

Seven Segment Display in Breadboard, being tested

To make it more interesting, wire up each segment to a digital pin on the board. For Arduino, I used pins 1-7, which is a bit interesting.

Seven Segment Display with all pins connected to Arduino

Firstly, you can’t connect pin 0 or pin 1 to anything while the sketch is uploading to the board. Once the program is uploaded, you can then connect these pins.

I used pins 1-7, and connected them to the display, skipping the ground pins.

The below code has 2 parts, and is derived from the blink program.

 

// the setup function runs once when you press reset or power the board

void setup() {

pinMode(7, OUTPUT);

pinMode(6, OUTPUT);

pinMode(5, OUTPUT);

pinMode(4, OUTPUT);

pinMode(3, OUTPUT);

pinMode(2, OUTPUT);

pinMode(1, OUTPUT);

// for each pin we want to use, we need to set it to output.

}

// the loop function runs over and over again forever

void loop() {

digitalWrite(7, HIGH); // turn on whatever segment is connected to pin 7

digitalWrite(6, LOW); // turn off whatever segment is connected to pin 6

digitalWrite(5, HIGH);

digitalWrite(4, LOW);

digitalWrite(3, HIGH);

digitalWrite(2, LOW);

digitalWrite(2, HIGH);

delay(4000); // wait for a 4 seconds

digitalWrite(7, LOW); // now whichever segment is connected to pin 7 will turn off

digitalWrite(6, HIGH); // now whichever segment is connected to 6 will turn on

digitalWrite(5, LOW);

digitalWrite(4, HIGH);

digitalWrite(3, LOW);

digitalWrite(2, HIGH);

digitalWrite(1, LOW);

delay(4000); // wait for 4 seconds

}

The display is really simple, it is made up of seven LEDs and you can turn on and off each part at the same time to from numbers. This is a basic introduction, you can add more displays for more advanced features.

Swollen Lithium Batteries

battery swolenLithium batteries are in the news for all the wrong reasons at the moment, and not for the first time.

We noticed that one of our batteries was a little swollen compared to the others. It seemed to be working OK though. We decided to open up the outer wrap to see if it was one cell or all of them, and to see if anything was obviously wrong. The battery was an 11.1V 1300mAHr LIPO. Check out some pics of us cutting off the outer black covering, to reveal that all three cells were swollen. There appeared to be no external sign of damage however. The cells feel as if they are swollen with gas.

 

We hooked it up to the  IMAX charger to see what kind of capacity our battery had. This battery is about five years old. Its nominal capacity is 1300mAHr. We fully charged it and then discharged it. We were pleasantly surprised to find it at 1095mAHr. That was discharging it at 200mA which is about C/6. By the time the charge and discharge was complete, the pack had swelled even more.

 

The question now is what to do with this battery. The Internet is full of videos of people doing all sorts of crazy things to lithium batteries too. We won’t be doing any of that here. We won’t be keeping this battery indoors, thats for sure. It could still be useful for some completely remote outdoor application, away from any kind of combustible material. We should probably dispose of it safely though. Note that all of the disassembly, charging and discharging was done outdoors and with lots of PPE.

 

 

Wooden Bicycle Pump

wooden pumpWell not quite, but a wooden handle anyway. We don’t just do bits and bytes at TOG! The bicycle pump handle broke and it seemed a shame to dump an otherwise perfectly good pump. So with a bit of nice round wood cut from an old roller blind pole, we made a new handle. Drilled a hole in the handle and a couple of small holes in the metal shaft of the piston to give the glue a bit of grip.

We wanted to use some glue with a little bit of flexibility or “give” in it, instead of something that set rock hard. That seemed to be the way the old handle was fitted. So our old reliable hot glue gun was fired up. It sets hard, but not rock hard. Pump is back in action, good as new, and it even looks a bit rustic with its new wooden handle. We have lots of members interested in bicycle things at TOG. Drop in and see what we get up to. Pics here.

More lathe work

Our lathe is finally getting some good use! This time, a small partHose adapter - work in progress was made from aluminium, a coupling for connecting two pieces of tubing for the water cooling system in the upcoming CNC router project. It will replace the existing temporary hose-and-clamps hack.

A piece of bar stock was clamped in a 4 jaw chuck, made into a
cylinder and turned down to about 16mm diameter. Next we turned half of it down to about 6mm and drilled a 4.5mm hole through it, using a drill chuck. Lastly we smoothed the edges slightly and parted the whole thing off.

The end result is more fIt fits!unctional and looks a lot better!

The whole operation went smoothly in overall retrospection. However, we had few small issues to deal with on the way. Firstly, it wasn’t obvious how to set gearing for the power feed, as the manual wasn’t very clear. Another problem was that the  square shape of stock, required the use of a 4 jaw chuck, which is not self-centring.  That adds a couple of extra steps to set up, as centring of the stock has to be done manually in such a case.

Ebike Charger Lead

cable

Nothing much to see here! A quick weekend afternoon hack. The ebike power supply died, so time to knock up a cable to charge the battery from a variable power supply.

A 3-pin XLR socket, a fuse holder with a 5A fuse and a diode for reverse current protection. A bit of soldering and heatshrink and we’re up and running. Checked it out. Set the power supply to 60v (same as the old charger) with 3A current limit, and we’re charging ok.