The useful TL431 chip

I haven’t made any electronics projects for a while now but I was working on some circuits at work that used a TL431 shunt regulator. This chip can be used to provide a 2.5V voltage reference and also 5V with the addition of two 10K resistors between the Ref pin and supply voltage and another to ground. A 470 ohm resistor on the input to the circuit limits current so not to damage anything. I looked at using one to improve the accuracy of one of my previous projects, an AA rechargeable battery tester.

I had made two testers based on completely different designs, the second uses the 1.1V internal reference to calculate the supply voltage which is used as a reference. The former simply uses a 10K resistor attached to the 3.3V out to the vref pin so it is nowhere near as accurate as the second tester I built. The second tester can also test up to 3 batteries at once.

 

Going back to the first tester I will use one of the TL431 chips to provide a 2.5V reference and hopefully that will improve accuracy as the 3.3V supply is provided by the CH340 on this clone and is far from ‘3.3V’. I don’t expect the accuracy to improve by much but it’s gonna be better than using a supply voltage as a reference as these can vary especially with cheap voltage regulators found on the Arduino clones. As the tester will only be measuring 1.5V max, 2.5V reference is enough. Unless of course you wanted to modify it to test lithium cells in which case you would need to configure the TL431 to provide a 5V reference instead.

H2S gas detector for battery charging with auto charger cut off

I posted back in January about a project I had in mind for our battery charging area at work to automatically turn off the power to the battery chargers if dangerous levels of toxic Hydrogen Sulphide were detected. The project was cancelled but resurrected about 3 months later when another battery failed releasing gas and we looked at this project again and decided it was a good idea to try building it.

Hydrogen Sulphide detector for battery charging areas.

So for the last two months I have been testing it and found that being based on a cheap MQ-136 sensor (good quality H2S sensors are very expensive) it performs reasonably well. With such a cheap sensor accurate readings of H2S are not really possible but it does detect gas and turn off the power which is exactly what we wanted it to do.

The project is based on an arduino as the controller with warning / status messages displayed on an LCD and gas level from 1-9 shown on an LED display. An alarm sounds when dangerous gas levels are present and the power to the chargers is turned off.

Continue reading

British Gas Hive Thermostat no signal issues

I recently replaced my home heating controls with the Hive system from British Gas as my old system had developed a fault with the receiver not switching on the boiler intermittently due to a faulty relay contact. The Hive system worked great for about 3 months until the other day when I noticed it was cold and the heating wasn’t working.

Thinking there was a fault with the boiler I had a look but everything was OK. The Hive receiver was showing the green light indicating that everything was OK. However everything was not OK. The hive thermostat just showed “NO SIGNAL” and no amount of resetting both the thermostat nor receiver would make it work. I decided to move the thermostat next to the boiler and hey presto! It worked. Took it back downstairs and no signal again. What was going on?

Continue reading

Arduino 6 input DVM 0 to +50V range

This is a project I built for work as an add on to our battery tester which is able to test up to six batteries at once. The battery tester is controlled by a PLC and does not show voltages in real time so we had no idea how long the battery runtime was remaining. A voltmeter that showed the battery voltage under test was required as our tester cuts off the battery at 10.5V for 12V and 21V for 24V lead acid batteries. At first I planned to use a standard panel meter and a six way switch to select the battery under test. This however proved to be quite (in comparison to alternatives) an expensive way of doing this.

Arduino 6 input voltmeter

I decided to make use of a few spare parts I had laying round in the workshop and make a digital voltmeter that could monitor six battery voltages at once on a single LCD. This would obviously have to be microcontroller based so I chose the Arduino over the 8051 due to it’s built in ADC and ease of use. As you can see from the photo the project uses a 20×4 character LCD and also monitors the temperature of the heatsink the load resistors are mounted to. A DS18B20 one wire digital thermometer was used for this and the battery voltage monitoring wires were connected to the Arduino’s ADC ports A0-A5 via a voltage divider.

Continue reading

Salvaging electronic components from old electronics… Not worth it?

I’ve seen a few websites where other electronics hobbyists talk about where they get their parts from and many do what I did about 25 years ago; salvage components from scrap electronics by desoldering them. I must admit it’s something I do from time to time; when I throw out old electronics I see if there are any parts worth keeping but mostly there isn’t. Some people on those forums desolder capacitors and resistors for re-use; to me this just isn’t worth it considering the price of components nowadays. Also there is the problem that here in the UK and most EU countries it is illegal to take stuff from the dump or out of dumpsters. It is counted as stealing as once you dump something it becomes the property of the city council or waste company. Many companies smash up equipment before disposal to prevent reuse as well.

Continue reading

What to do with a blown / faulty ATmega328 – Don’t throw it out… It may still be useful.

In one of my past arduino projects I accidentally damaged a Arduino Mega328 MCU (or it may have been faulty to begin with) but I decided to keep hold of it in case I needed it for a very basic project that didn’t need many ports.

The chip’s pins all functioned OK but it had a strange problem; when the serial port was actively sending data or any other pins on port D were being used, some of the other pins were going ‘partially high’ when they shouldn’t. I noticed this when I connected a 7 segment display to the board as several segments flickered or lit dimly when adjacent pins were high. Any attempts at multiplexing or any other high speed manipulation of port D’s pins resulted in some other pins’s output voltages dropping significantly. The display had adequate resistors and I even tried connecting it via a ULN2803 IC to no avail.

Continue reading

A simple Arduino gas detector example.

Overview

So you may be wondering why I tried this. Well, I wrote some code to check for dangerous gases released when charging lead acid batteries as a safety concern at work. This came about because we charge lots of sealed lead acid batteries which usually charge without any problems but on one occasion one battery had failed causing the room to fill with a rotten egg stink. This is not just a bad smell; in fact it was Hydrogen Sulphide we were smelling which is very toxic in large concentrations. This definitely was bad; the entire building stunk on both floors and it took all day to get rid of the stink with windows open. In the middle of winter I might add. Faulty batteries can also release hydrogen which is explosive if in a sealed room and with a high enough concentration although modern SLA batteries do not give off nowhere near as much as flooded types. However H2S gas is bad for your health in any concentration and is produced by all lead acid batteries when misused or overcharged. Such gases are also found in rubbish dumps and sewers and other areas with decomposing organic matter in enclosed spaces.

So I wrote code for a sensor that would detect these gases and display the levels on a LCD display triggering visual and audible alarms if thresholds were met. The software also triggered a relay which could turn off the chargers and turn on an extractor fan. Often batteries were left on charge overnight and automatic gas detection and prevention was a must. I also planned to add a remote monitoring facility as well.

Anyway for reasons I cannot explain the project was cancelled so I simplified my code and added a methane sensor to the mix as well. You guessed it; there is another use for my code…

Continue reading

Building an LCD alarm clock & DS1307 RTC accuracy

I’ve been working on a new Arduino project; the ultimate alarm clock which shows the time and date on a 16×2 LCD module and features multiple alarms with repeat / auto arm and radio function. I used a Tiny DS1307 RTC and EEPROM module which is a breadboard / veroboard compatible PCB containing a DS1307 RTC chip and a 24C32 i2C EEPROM. There is also a place for a DS18B20 thermal sensor but mine did not have this installed.

The clock functions great but I have found that the RTC module gains time about 6 seconds a day. This is due to a number of issues; the quality of the crystal used, the position of it on the PCB, the value of the load capacitors and it’s questionable if the DS1307 is a genuine Maxim chip or not. The module came from Banggood (China) at a cost of only a few pence of the chip itself (in bulk) so who knows.

The DS1307 is not known for it’s accuracy though; the DS3231 is a better choice if you need accuracy as it works with the basic functions of the DS1307 libraries. It just lacks some features such as onboard NVRAM. As I needed to use this NVRAM to store alarm settings etc I had to go with the DS1307 and write some code to halt the Arduino for 6 seconds then write the time back to the DS1307 minus 6 seconds. This should work in theory bringing the accuracy in line with the DS3231 and DS3232 RTC chips.

I have been testing it for a few days and I can now post the rest of the project details.

Continue reading

Atari Portfolio retro computers

Around 12 years ago I had four Atari Portfolio palmtop computers complete with boxes, manuals and a ton of memory cards plus many accessories. For some really stupid reason I decided that they were a pieces of crap and chucked them (I faintly remember trying to sell them on ebay without success) but not before smashing them up for fun.

Well I came across that website I made all those years ago and thought I’d check what they are worth now. Well two sold for over £300 so I really should have kept them as I could have made about a grand out of them. I’ve been clearing out a lot of ‘junk’ recently and it makes me wonder if I should keep it. Who knows what it will be worth in 10 years time?

That’s probably why people hoard things. But I really should not have destroyed those Atari Portfolios…. Here’s some before and after pictures which were taken on a equally 12 year old crappy digital camera.

Continue reading

NIMH battery tester – firmware version 2. Now with improved voltage reading accuracy.

In my last post I built a multiple AA battery tester but it used the 5V as a voltage reference which wasn’t ideal and was giving readings that were good but could be better. I modified the code to use the 1.1V internal reference of the Mega328 MCU to calculate the actual 5V supply voltage and this has proved to be much better. Voltages measured by the Arduino are now within 10mV when compared with a calibrated DVM.

As far as the battery tester goes this will produce a more accurate mAh rating and a couple of tests show that battery capacity is now within 100mAh instead of the 250mAh as it was before. These measurements were taken at the load resistors as the battery holders and wiring produced a voltage drop between 30 and 110mV which at 550mA load current is fairly acceptable. If you wish to build this project please refer to my previous post as all the build details are in there. I will also put the latest firmware download on the project post as well.

Issues to resolve – spurious voltages displayed when no battery present. Does not affect operation but will look into resolving this.

Arduino NIMH battery tester update

Back in October I posted about a basic NIMH battery tester based on an Arduino nano I made some time back which was a successful project and works quite well however it could only test one battery at a time and didn’t apply a constant current load. It was good but not very accurate and I really wanted the ability to test more than one battery at once.

So looking around for inspiration I saw this Rechargeable battery tester on instructables by Brian Hobbs which can test three batteries at once and displays the test progress and results on a Nokia 5110 type LCD. However the code has some small drawbacks such as using the 5V supply as the reference voltage which isn’t the most accurate as the ‘5V’ supply varies depending on the PSU used and / or the voltage regulator.

Arduino based AA NIMH battery tester

As for other things it does not apply a constant current load either but it does measure the voltage drop across the load & calculates load current from that so it’s much more accurate than my previous project. So far the project has been built hardware wise and is running the original source code with some slight changes to provide indication of test status on a series of LED’s as well as the LCD so test status can be seen from a glance.

Continue reading

Arduino scrolling clock and custom message on 5×7 matrix

Introduction

I’ve been playing around with a red 5×7 dot matrix LED display module which I have had in my spares box for a while. I thought about making some sort of scrolling message display as an Arduino project but could not find any more of these modules online as I’d need at least another seven. However I did have an Arduino Nano, a small case with a scratched lid and a piece of veroboard that just happened to fit the box exactly.

I needed to practice my programming skills and after a few attempts of trying to get the display connections right I was able to make some characters appear on the display. It wasn’t anything useful so following a few examples on the internet I ended up with a scrolling message that was hard coded into the program.

Arduino based scrolling message display

Completed messaging display in ABS case

For this to be of any use I needed to be able to upload messages to it so I wrote some code to store the incoming serial data into a buffer then into an array to be displayed. However I couldn’t get it working right; it took ages to transfer the message and every time you wanted to change the message you had to power it off and on again.

It turned out I’d got some of the curly braces in the wrong positions in one of the ‘for’ loops which was causing the delays. I stuffed it into the case (the scratch was on the part which would be cut out for the display window) and then thought, that’s nice and put it in the cupboard and forgot about it.

Continue reading