Veer and Hall

A project log for Yapolamp

An experimental torch/flashlight intended to be safer for eyes, completely inspired by and built upon the TritiLED project

Simon MerrettSimon Merrett 07/12/2017 at 01:215 Comments

The story so far...

So, I pivoted away from using a pulse-based voltage doubling circuit to drive the charger output MOSFET because if the battery was completely dead, there would be no way for the Yapolamp microcontroller to create the pulse and the charging circuit would never be enabled.

I also read the TP4056 datasheet which told me that the TP4056 has protection against back-feed, so I decided to put the TP4056 on the torch side of the charging circuit.

Protection and new circuit layout

I bought a version of the TP4056 which has undervoltage and overcurrent protection as my Lithium Ion 18650 cell is unprotected and I particularly didn't want an over-discharge to damage the cell. However, even more important than that is preventing high currents due a potential short-circuit. I don't plan on allowing a short circuit (I'm planning to use an ingress protected enclosure) but I am happy to double up on safety features as the intended owner is a small boy.

When the new module arrived, I soldered a 2.1mm barrel jack socket on its battery terminals so that I can easily plug the 18650 holder in and remove it if required. The battery output in the pictures and videos in this log isn't attached to the Yapolamp circuit, as the point of this demonstration was to look at the safety and switching of the charging circuit. The lamp is powered from the Arduino Nano's 3.3V rail and the TP4056 is powered from the 5V rail.

Here's a picture of the simple TP4056 module that I was using with the voltage doubler circuitSource:, Fair Use.

And here's the one with the protection circuit :

Source:, Fair Use.

Safety check

I conducted the "tongue test" across the input terminals of the TP4056 module with the battery connected and can confirm that there's no tingling. I'm happy that moving the TP4056 module over to the lamp from the charging circuit side is the best thing to do, even if it does make it more challenging to manufacture a compact torch.

New idea for breadboarding SMT/SMD components

You may have noticed the LEDs are mounted on a pair of copper foil strips. Here's a close-up and section schematic: The problem I was encountering was that I was finding it very hard to successfully solder wires onto the 5630 size SMT LEDs. I also wanted to progressively add LEDs to make a sufficient total brightness and that only multiplied the soldering burden. Instead, I placed two parallel rows of small (5mm dia by 2mm high) neodymium magnets on a piece of steel flat, insulated them with electrical tape and then placed two strips of copper tape over the top. There is enough ferrous content in these Chanzon 5630 chips to hold them down onto the copper foil and there's also enough in the jumper cable pins to hold the electrical circuit together purely using the attractive force of the magnets.

Hall effect as a safety switch

So, did the Hall effect sensor work? YES! I was disappointed to start with because the package I got was a latching version. It needs the reverse magnetic field to switch it. I overcame this by presenting the magnet on its side and "sliding" an edge past the Hall effect sensor. I have also tried using a magnet slightly further away from the one moving up and down (simulating the torch being placed in its charging dock) to keep the sensor latched in the off position until the more powerful field from the magnet in the torch overpowers it (with respect to the Hall effect sensor, which will be closer to the magnet in the torch, once inserted into the charging dock). Here it is working - you can see the TP4056 charging light coming on in full charge mode:

Conclusion and Next Steps

I'm happy that this is the safe and reliable charging circuit I want to use. Now I need to start developing the code for the different modes of operation. I can produce high and low brightness modes and switch power off during the charging, using an auto detection of the charger's 5V input. However, I need to look at sleeping between pulses in the low power modes. There's a balance here between doing as much as possible on the easy to iterate Arduino Nano and the planned ATtiny85, which will need different port manipulation and sleep code.

I'll leave you with the Yapolamp switching between "on"and "always on" modes (as currently programmed), which nicely demonstrates the SMD breadboarding technique at work.


Ted Yapo wrote 07/13/2017 at 02:54 point

Congrats on hitting the HaD blog with this! 

  Are you sure? yes | no

Simon Merrett wrote 07/13/2017 at 05:35 point

Thanks - so far the "not a hack" accusation counter is at zero, but it's early days! 

  Are you sure? yes | no

Simon Merrett wrote 07/13/2017 at 06:06 point

We're at 1 already! 

  Are you sure? yes | no

Ted Yapo wrote 07/12/2017 at 02:46 point

I like the magnetic mounting - someone mentioned that this is used in LED testers - they may be attracted to magnets for just this reason.

  Are you sure? yes | no

Simon Merrett wrote 07/12/2017 at 07:00 point

Thanks Ted, I'm pretty pleased with it - even submitted it to the HAD blog tips line! I think it requires the foil and insulation tape layer to be quite soft and allow some "give" to get the electrical connection. 

  Are you sure? yes | no