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

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

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

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

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


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

Playing with an 8051 microcontroller

I’ve been using the Arduino for a while now and made a few projects but at work we use the 8051 as the primary micro for our in house equipment. Yeah it’s outdated but Silicon Labs have taken the original 8051 design and vastly improved it with clock speeds of 100Mhz. It can easily outperform an Arduino and technically is a more capable processor.

However support is limited and its for professional programmers only whereas the Arduino is more for hobbyists. Knowledge of the CPU and in depth knowledge of C is required to get anywhere with this. I decided to buy an Atmel version which is more or less based on the original Intel design but it does run at 24Mhz. It also comes in a DIP package too so is ideal for breadboard and veroboard projects.

I found that development kit and software was expensive unless you used the outdated SDCC compiler or BASCOM. Support was lacking and I struggled to make anything useful with it. Compared to the Arduino with it’s libraries etc you don’t need to know how the AVR chip works and there’s loads of help out there.

Continue reading

A WIFI spectrum analyzer and Talk-Talk routers suck A$$

A close relative of mine has been having lots of wifi connection issues over the last few months but just on a couple of devices. A scan of the wifi neighborhood showed only a couple of signals from adjacent houses which were too weak to cause a problem.

I tried changing the channels, 150 or 300 bandwidth modes and even tried dropping to 54G compatibility. The problem would be fixed but return a few days later. I tried disabling the wifi adaptor in one of the affected laptops and used a USB adaptor instead. I couldn’t swap the router as this was needed for IPTV (talk talk) and my replacement didn’t support it. Same problem with different adaptors. What was going on? Mobile phones and tablets were fine; just the two Windows 7 / 10 devices refused to work. I needed to scan for interference and here’s where the Arduino came in.

Continue reading