DIY Current Meter using a Ferrite Core and Hall Sensor
I built a DC ammeter using a toroidal ferrite core and a Hall Effect sensor (WSH130NL). The idea is, when current flows through a wire around a toroidal core, it creates a magnetic field inside the core. For AC measurements we can just use a secondary winding and get a pretty good step down transformer producing an effective voltage which can be converted into current values. But with a DC steady signal we have to measure the magnetic flux in a different manner. Overall now with this approach we get an isolated current measurement. And by choosing the right number of windings, you can adjust the sensitivity and resolution of your ammeter to suit your needs. The same can be converted later with the help of a PCB provided by JLCPCB. As I got my MCU dev board fabricated from there in a $2 price. See the full article with code from here: https://www.hackster.io/sainisagar7294/diy-current-meter-using-a-ferrite-core-and-hall-sensor-4a91aa
How Does It Work?
When current passes through a conductor coiled around a toroidal ferrite core, it generates a magnetic field within the core. Due to the ferrite’s high permeability, the magnetic field is largely confined inside the core. By placing a Hall Effect sensor in the air gap, the sensor is positioned directly in the path of the magnetic flux. It then generates a voltage proportional to the magnetic field passing through it.
Components Required
WSH130NL Hall Effect Sensor
Toroidal Ferrite Core
Enamelled Copper Wire
10K Ohm Resistor
0.1uF Capacitor
Arduino Uno/Nano
16x2 LCD Display I2C
Building the DC Ammeter - Step by Step
The toroidal ferrite core is the heart of this ammeter. You can salvage one from an old power supply, a common-mode choke, or buy one online. The size doesn't matter too much, but a larger core gives you more room to wind wires.
Cutting the Air Gap:
This is the most critical and tricky step. We need to cut a small gap in the toroid where the Hall sensor will sit.
Winding the Toroid:
I used 10 turns of 24 AWG enamelled copper wire on a ferrite core. More windings mean a stronger magnetic field for the same current.
Placing the Hall Effect Sensor:
You can place the sensor, make sure it is flat in the middle of the gap, then secure it using hot glue and some tape. The orientation decides the polarity, but it doesn't matter even in this case because the steady state sensor readings are common mode by VDD/2.
Arduino Code:
The Arduino's 10-bit ADC gives us 1024 steps across 0-5V, which translates to approximately 4.88mV per step.
How to Calibrate:
Upload the code to your Arduino with SENSITIVITY set to 0 initially
With no current flowing, write down value of V_OFFSET.
Pass a known current of say 1A and note the voltage.
Pass another known current of 3A, note the voltage
Update the V_OFFSET and SENSITIVITY defines in the code
Working:
At 0A:
At 1A:
At 2A:
At: 3A:
#HallEffect# #PCB# #currentmeter# #powermeter# #Arduino#
Charging the 12V LEAD ACID Beast with Beauty
Charging the 12V LEAD ACID Beast with Beauty
If you own a motorcycle, you already know the pain. I was little out of station for a couple of weeks and when I came home and gave a push to my bike, there was nothing. The battery is dead. Lead-acid batteries self-discharge over time, and if you don't ride often enough, the battery just slowly dies on you. Buying a new battery every few months is not an option. So, I used to charge manually on a workstation which costs me time and money. Even though most of them are using just a transformer with a rectifier, no regulation, no protection, just brute force current being dumped into the battery. But I am an electronics engineer and that’s how I decided to give a try to lead acid battery charging.
The one that actually understands how to charge a battery properly. With trickle charge for deeply discharged batteries, constant current for bulk charging, over-charge for topping it off, and float charge to keep it maintained without overcharging. The whole charging profile, done right. That's where the CN3767 comes in. It's a dedicated 12V lead-acid battery charger controller IC from Consonance Electronics that does everything I just described. I have designed a PCB in EasyEDA and fabricated it from JLCPCB and tested out the final prototype.
PCB Design
You can download the Gerber files along with BOM and CPL from here. I have used JLCPCB for manufacturing because their services are available in a wide domain with reasonable prices. And because I have designed the PCB in easyEDA online which has an integration with JLCPCB. At least this can give me a peace of mind over the files.
Testing & Results: I set up a DC bench power supply set to 18V and took a 12V/7Ah lead-acid motorcycle battery. For monitoring put the multimeter on battery terminals, current clamp on charge line. There may be drop in wires and across device so the voltage at power supply and battery end may vary.
Constant Current (CC) Mode Test:
With the battery at around 12V, I connected the charger. The red CHRG LED immediately lit up, confirming the charger entered the charging state. The current stayed rock-steady at approximately 1A throughout the CC phase. That's the CN3767 doing its job, regulating the current via the sense resistor feedback loop.
Constant Voltage (CV) Mode Test:
As the battery voltage approached 14.8V, I observed the transition to over-charge mode. The voltage locked at 14.8V and current started tapering down from 1A. This is the critical phase where the charger is topping off the battery. The voltage holds steady while the current gradually decreases as the battery reaches full capacity.
Outro: Building a proper battery charger is not that hard when you have the right IC. The CN3767 takes care of the entire charging algorithm. Even though I am going to sell some pieces to my motorcycle repair shop, so everyone who needs a proper solution can get this design. I will increase the rating to maybe 3A in CC mode for faster charging. Motorcycle batteries can easily handle up to 5A. We have seen that the transition from CC to CV mode is smooth, the regulation voltages are accurate, and the LED indicators give clear feedback on the charging state. The best part? That MPPT input means I can slap a small solar panel on the bike someday and have a self-maintaining battery system. Charging the beast with beauty, indeed.
#PCB#