Sunday, October 21, 2018

Busy Sunday with Sparkfun's nRf52832 Dev Board

My Sunday(Oct 21, 2018) has been so so so busy because of my beacon experiment. Actually for 2 weeks now, I was stuck at why my battery charge level monitoring circuit would not work(I was just toggling between the board's A4 and A5 analog pins). And I gave up on it and went on to do another task to make the piezo speaker work with the board. I faced another very challenging task why it does not work with digital pin 10, then I remembered previously when experimented with the LED on/off sketch and I used digital pin 15 and it worked, so I transferred the connection to that pin and it worked very well. Because of this I realized that maybe the analog pins A4 and A5 are made for a different purpose so I tried to experiment with A6 and finally, I am getting good results. So, I am able to make both work.

With this success, I prepared a simple sketch that will broadcast Ibeacon, will communicate with the pc to continuously transmit battery charge level(2V up tp 4.2V)  and add GATT Services to get the battery charge level and be able to turn on / off the piezo speaker. So sad that the nRF52832 Dev Board is not compatible with Arduino's Tone library, I am not able to upload the Super Mario Brothers theme music into it.

Creating the program(sketch) is the most critical part because the battery life depends on it, so the sketch must be highly optimized to save power and battery will at least last longer than 1 day. The sketch I created is not the best solution, there are better ways to do it to make it conserve energy and the 800mAH battery could last longer than 3 months. The piezo speaker can consume more than 50mA alone, while connecting to the device would consume 30mAnot to mention the builtin voltage regulator has a normal current leakage of 10 mA and of course the red LED connected to the power source normall consumes 16-18 mA(but this can be disconnected easily as sparkfun provided the connection at the back), at normal operation it(the nRf52832 ic alone) normally consumes around 7mA. I heard that other sketches can lower the normal consumption to 0.3mA or even down to 1microA that should be enough to make it last for several days by putting the device at deep sleep. The sketch I created would only let the device enter the low power mode. I have not tried to make it enter into deep sleep mode because the last time I tried it, the nRF connect app could not connect to it. Maybe there is a technique to make it not to interfere with the connection process.

To be honest, the connection is very stable, it does not disconnect making it ideal as a key finder.

Here is the hardware setup:

My actual device on a breadboard:


With this current configuration, I can charge the battery while programming it. 

Sample Serial Output:

The nRF Connect App Screen:


Here is the screen recording:(you can hear the actual beeping of the beacon:



And finally the sketch:
You may download the sketch here.

3 comments:

  1. Well Explained. I am searching for the same. Thanks for sharing it here.
    Also , checkout my website if you want to know about computer guides and reviews
    computerbuyingsetup2020.wordpress.com

    ReplyDelete

  2. Thank you for sharing such useful information. I really enjoyed while reading your article and it is good to know the latest updates. You can also visit this website. Comparison of UN38.3 and IEC62133 Standards; Analysis of UN3813 Standard Test Results & Causes
    battery test standard

    ReplyDelete