Close

Data Logger Stage

A project log for imPulse

Energy harvesting alternative for bikes including data logging, smart lighting system and power distribution board for power banks

javier-betancorJavier Betancor 07/06/2018 at 08:170 Comments

In this part of the project  I am going to focus on building and calibration of the data logger for the bike. I would like to measure the current generated at a certain voltage and save it on a uSD card module. From there I should be able to get the power generated on each trip. In other words, I should be able to validate my setup!

I know I could add GPS, speedometer and cadence sensors, but we are on the wearable era! I think it is more useful to use your watch rather than add a lot of circuits to your setup that would increase the space needed, the cost of the overall project and will also use more energy. This could be saved for future implementations, but for now lets stick to basics. First walk and then... run!!

Components needed:


VOLTMETER (voltage divider)

My question at this stage was very simple, how could I build an accurate voltmeter with a voltage divider? And I found out that it depends on a lot of factors, so...hands on with electronics!

My aim with all diagrams at this stage is to show you how I did things (the big picture). I am not trying to draw ideal and standardised schematics as I believe it would be harder to understand. Who knows if the next 'Einstein' will read this and based on the level of difficulty will give up or continue learning about these little things! In other words, things as simple and easy as possible. It will help others to discover new areas of interest.

Coming back to the main topic, it is possible to design a digital voltmeter with two resistors in series (voltage divider). If you have a look on the diagram, I have also connected a standard voltmeter in parallel, so I can validate my voltmeter. I finally attach Vout wire to an Analog Input (A/I) on the Arduino.

Now lets look at this setup in a more 'specific' way. A/I pins on the Arduino are able to read a signal of max. 5V and the resolution of the Analog to Digital Converter (ADC) is 10 bits or 1024 divisions (2^10 bits = 1024 divisions). Remember that in programming the range would be from 0 to 1023 divisions. In my case, I am planning to read a maximum of 25V for safety, so Vin will be 25V. Vout should be less than 5V, so I set Vout to be 4V when Vin is 25V. That is how a voltage divider 'should' work.

Next step...resistors! (R1 and R2). I had available some 1 KOhm resistors, so I grabbed a multimeter and measured its real value. The real value for R1 was 994 Ohm. Now, I assume that there is no multimeter and MCU in the diagram. Applying Kirchhoff's voltage law we get two equations and two unknowns:

Rearranging,

An this is how the value of R2 is calculated. In my case, the ideal value of R2 should be equal to 189.3 Ohm. As it is fairly difficult to find a standard resistor with that value, I decided to approximate the value so R2 is 220 Ohm. Wait a second! Grab the multimeter and measure the real resistance! The real value for R2 was 217.3 Ohm. Now it is very important to check that Vout will never reach 5V, so rearranging from above equations:

If the value is less than 5V, you are good to go (mine was 4.4898V).

Now, last thing before proceeding with the calibration as with this little tweak you will avoid a huge headache. If you connect Arduino to the computer (as we all do) and check voltage in Vref pin by choosing GND as the the usual Arduino one, you will realise that this voltage is less than 5V. In other words, if Vref is different, readings will also be different. The general solution for me was to apply a consistent voltage signal through Vin pin on Arduino. What a good chance to start using my power bank (the original power source)! As it is able to provide a max. of 5V and I need 7V minimum and 12V max. (check MCU specifications) I had to add a step-up DC converter. From trial and error I found that 9V is enough, so readings are not altered when adding more devices.

Regarding the calibration, I had the chance of using a nice and reliable PSU where I currently work. Therefore, my aim was to make 100 readings from Arduino, make an Excel spreadsheet (attached soon!) with readings for each voltage increment and note the real voltage value with the multimeter. Excel has a nice feature to compute a trend line form a graph, so you should be able to figure out the gain (sensitivity) as the graph should be linear. No worries, Arduino code will be uploaded.

AMPEREMETER

As it can be seen, it is almost the same as the voltage divider but in this case, the multimeter is set as amperemeter. I am using the ACS712-30A hall effect sensor because I already had it, but I am sure you can try using two resistors in parallel.

The output from the module is given in mV, so the main task will be changing from divisions (div) to mV and convert it to A using the sensitivity coefficient. Please, feel free to check the data sheet for more information here.

This particular module can measure from -30A to 30A, so 511 div should be our 'zero' point. This is aka offset and has a value of 2500mV (it makes sense!). Another essential aspect is the sensitivity, which is 66mV/A for this module. Remember to check that Vref on the Arduino has a stable voltage of 5V or similar, so you will avoid unreliable readings.

All in all, we are in a unit conversion problem, so lets name the output of the sensor as in the diagram (OUT) and 'CS' the output in A:

uSD CARD READER

This is very well documented on Internet, but I will explain what I did. Figure below shows where it is located  on the diagram, combined with the voltmeter and the amperemeter:

I wanted to leave the default layout for the uSD card reader as I believe it would be easier to set it up. It is possible to load a data logger example from the Arduino IDE which I think has all that I was aiming for. I also wanted to add an extra feature in which a new data log will be created each time you go for a ride. I hope you enjoy the code!!

VALIDATION

This is very cool, but let me show you where exactly is located this powerful feature on the main diagram:

I hope this clarifies all work done so far on the Data Logging and Power Generation stages. I am also assuming that the data logging stage is powered by one of the power banks. I have been using different capacitors (C) for the power generation stage. The best one so far is 100uF@25V.

As you can imagine, using a breadboard you may expect a really big bunch of wires everywhere. My partner (in crime) said that it is like a rainbow!! She is definitely right...

Anyways, let me post a real proof of what I am doing, another video!!

I also managed to export the data and create a nice graph:

This was right after the video, at home and using my hands to create energy. I did not reach a very high rotational speed but I cannot quantify it as I do not have a speedometer or tachometer.

My sincere apologies to electrobob and Jurist as I mentioned I was generating a max. of 16W (1A @16V). Right now I am generating a max. 6.87W (1.03A@6.63V), which is reasonable. Further tests are coming (and fine tuning of the data logging system)!

All in all, this setup costs around 1/4 of an in hub dynamo setup and I am generating double the power without feeling any drag at all (I cannot prove It yet). I believe all of this is due to the gear system. 

Guys, this is turning into something really interesting. Hope I will entertain you on my next stage! 

Discussions