I received my first quadcopter for Christmas, a XS Nano Quad from Revell. It’s a tiny quadcopter, which I find extremely fun to play with. Unfortunately, the battery lasts only about 5 minutes (3.7V 100mAh) and the charge time is between 30 and 40 minutes.
Because I regularly forget I put it to charge, I decided to make a simple device which can notify me as soon as the battery is fully charged, allowing me to maximise play time!
Determining the charge status
In order to decide when to trigger the notification, something measurable is required to base that decision on. Luckily, the provided charge cable has a built-in LED which lights up when charging and turns off when fully charged. Using a photoresistor or light dependent resistor (LDR), I can detect whether the LED is on or off, without having to hack the cable.
The circuit is simple, using a voltage divider with on one side the LDR and on the other a fixed 10k resistor, the measuring point’s output voltage will vary depending on the LDR’s resistance. For example:
- LDR @ 0 ohms (bright light), Vout will be about 3.3V
- LDR @ 10k ohms (light), Vout will be 3.3V/2 or 1.65V
- LDR @ 30k ohms (no light), Vout will be 3.3V/4 or 0.825V
Note that these values can differ per LDR. I measured mine using a multimeter in different light conditions.
A simple audible notification such as a buzzer could be used, but I would have to be in the same room to hear it, which is not always guaranteed. I decided to go for a notification on my smartphone. Rather than pick a specific iOS or Android notification system, I picked a more generic one: e-mail.
Because of the internet connectivity requirement, a basic Arduino is not sufficient and adding a wifi shield is not cost effective (not to mention the size). That’s why I turned to the Particle Photon (formerly Spark). It’s a $19 microcontroller with onboard wifi and a bunch of analog and digital pins, and I just happen to have some at hand waiting to be integrated into a project. This could however be achieved with a variety of other development boards.
Part of the reason for picking the Photon, is that there is a Particle channel on IFTTT, making it even easier to trigger notifications. If you don’t know IFTTT, it stands for “If This, Then That”. It’s an online tool that allows you to create “recipes”: a combination of trigger and action.
There is a recipe available for e-mail notification which I used as the starting point for my notification system. For the e-mail side, I had to specify the address to send to, the title and content. For the Photon side, which event would trigger the recipe and which particle device to use.
If e-mail notifications is not what you’re looking for, you can also install the IFTTT app on your smartphone and use their own notification system. Instead of using the Gmail channel, use the notification channel instead. The configuration of the recipe is even easier!
The code for the Photon is rather straightforward and the same, no matter what notification method is used. You’ll notice the “Spark.publish” function triggers the event called “status” with content “charging” or “charged” depending on the value read from the LDR.
Putting it all together
To power the Photon from the same power source the quadcopter is charged from, I soldered a USB passthrough board, tapping off the 5V and GND pins to the Photon. The Photon and voltage divider is put on a mini breadboard, which is attached to a USB charger. The LDR is connected such that it sits right on top of the charge state LED.
To have the readings as accurate as possible, it is best to isolate all incoming light from the LDR. To do this, I added a piece of heat shrink tubing around the sensor, only allowing light coming from straight in front of it. If all went well, you should be receiving a notification when it’s fully charged, reminding you to have some fun with it!
Like the project? What would you need a notifier for? Let me know in the comments!