The best part about this video for me was the project file on easyeda. Not because I want to build this myself, but because I kept searching for a website like that and it is really useful for me. Thanks.
A smart engineer with a German accent makes his own power meter/logger but when not satisfied with just an oled screen, adds a data logger too, Great Job!!!
GS, This is one fantastic project. Made one and even added a few mods to the code. I didn't have to buy anything new or substitute. I had everything already and was going to design and code this exact design from scratch, but you did all the hard work for me, and I thank you for it. Also, thank goodness for these cheap modules. This and many other projects would not have even been possible only 5-10 years ago, without these cheap and wonderful modules from China.
for the logging you can use an CSV file and open it with format and it's pretty easy to create for example per each line you can have: TIME,VOLTAGE,CURRENT just use comma (, ) as separator between you values and excel should be able to put them in column for you
I love the INA219 module. I once used one to replace an expensive stepper motor with a far-cheaper and more powerful 12VDC gear motor. I had a n arm on the shaft of the motor, and I just blocked it so that it could not turn past the points where I wanted it to stop. Then I would start the motor turning and monitor the current. When the arm hit the block, the motor would start taking more current, and I would know it was time to shut it off. It was self-calibrating! It worked perfectly once I thought to drop a little super glue on the flange and motor shaft, because the motor was so powerful the flange set screws were not enough. Hint for your data logging: Have your Arduino log all data to a .csv file. Each line is a row of data, separated by commas, and you can even have the Arduino do some of your calculations for you and include them on the line. Stick the SD card into your computer, double-click the .csv file, and it opens up in Excel, each data point in it's own cell, nice neat rows and columns. Select a column, select "Insert", and insert a graph of the data, easy-peazy. Lastly, I know this video was created four years ago, but we now have some data logger modules. I got two of the ones you just plug an Arduino Nano into, and I got one of them working yesterday. The module gives you everything pre-wired, including a real time clock module. So you can time-stamp your data in the .csv file, you just need two more commas and columns, and you can see when that spike occurred. I like this data logger. I intend to program it to accept a string from another Arduino and log it, with a time stamp, to a .csv file. The string will be a pre-formatted string sent via SoftwareSerial.h. That way I have the complexity and memory requirements of the RTC and SD card set aside from the Arduino doing the real work, leaving precious memory for other things.
Thank you so much for this video and saying to use SdFat library. I have lost a lot of time, not knowing why I could not open a file on a SD card with a Chinese SD module and the SD library. I found nothing about it on many forums. Now it works ! GREAT !!
Great video. The resolution of the OLED display is not set correctly though. It is not set to the maximum resolution. Edit the library file in order to set the correct resolution 128x64 pixels .
@@ChoudryArif it's not hardware. I thought the same, and after 5 hours of troubleshooting I finally found the solution. You need to change a line of code from the library itself. Either way the display will work at half resolution, even if you change it from de IDE
@@BnMroGaming I don't know if the memory has been upgraded on the current models of the arduino, but from what I saw on the instructables site, they ran in on the 128X32 because of memory limitations. The 128X64 used too much.
I needed this last year and just abandoned the project, (cause I'm a beginner and couldn't find how to do it) will resume it in a few weeks when I have time. Thank you!
Awesome video, I really like how you created the data logger for power consumption, this will prove really useful for evaluating and diagnosing battery life.
Nice video! Tips: Output it into a csv formatted file instead and you can directly open it into any program suitable. Then you dont have to copy paste the rows :)
instead of writing it to a file and graphing via excel, i would rather send all data via UDP to influxdb and have real time graph using grafana, apart of this part, awesome video, thanks a ton !!!! Helped me so much
This is a very good project for measure DC power comsumption, and have a better estimation of how long a battery powered circuit will last. But not to calculate how much will cost you to charge your smartphone, for exmaple (0:25), because you are not measuring the AC power comsumption and you can't even estimate it because you don't know the power factor of your charger.
Your OLED library is set on 128×32. Check the library (.h file) comment the line that defines (#define) the 128×32 resolution mode and uncomment the line with 128×64 :)
You should modify the sketch to create a single CSV file (current, voltage and time separated by comma or semicolon), so you wouldn't have to copy the 3 txt files to Excel, but you could easily open with it, and create diagrams out-of-the-box. :)
I just started a similar build some days ago using a Pro Mini, ACS712 current sensor and the same OLED. Since I mostly record to my PC anyway my unit is powered using a USB port (thats not the input-port but a dedicated one) which also sends current values to the connected PC for display and recording. I opted to use the internal 1.1V reference instead on VCC, so changes in the PCs supply voltage don't offset the ADC that much. You might want to check this on your build if you connected the battery directly to VCC - afair VCC is used as the default reference for the ADC so your measurements might get skewed with falling battery voltage. Using the 1.1V also allowed me to dynamically scale for
There is an issue with the energy calculation in the sketch. The value being added to the total energy consumed has to consider the interval at which measurements are made. The interval is set in milliseconds, so a variable or constant for "measurementsPerHour = 3,600,000 / interval" has to be used as the divider when adding to the energy displayed in mWh. To provide an example using the 100ms interval used in the sketch: measurementsPerHour = 36,000 Now given 650mW for example, each interval adds 0.0186mWh to the energy total.
It's strange that it's only comment like that, a lot of people made this project and no one noticed wrong calculations. I had 6 wh instead 1.5 when i dig in i found that it's doesn't correspond to the time
I appreciate this comment was a long time ago, but my code is based off this video and I found the same problem, although i've found even though the interval is set to 100ms I only get an accurate wh reading if I divide by ~410ms intervals: (energy = energy + (power / 8780.4878);) is there a limit to the sample rate of the INA219? I thought it was supposed to be capable of ~14 samples a second (~every 71ms)
I'm working on an expanded version of this for a project I'm working on :) Tracks a whole bunch of statistics for lithium ion battery management, coulomb counting, battery capacity over time, voltage cut off etc. I've been toying with the idea of adding an OLED display and SD card reader (this primarily so I can avoid writing to EEPROM too much). After watching your video I may just add these :D
Ross Bishop sweet have a very simple version of a power meter for a 10S battery on a skateboard. I used a bunch of zener diodes but in hindsight it burns quite a bit of power so thinking maybe voltage divider first then measure, any thoughts/ideas?
To measure the current? A hall sensor if you can grab one, I'm using one of the ACS712 jobbies you can get on eBay for a few quid. The 20A version outputs 100mV/A above about a 2.5V float voltage (I'm using a 5V Arduino Nano like in this video) and you can get down to 50mA resolution with the 10 bit ADC. There's a readily available 30A one too, 66mV/A so not quite as nice to work with and I think you might lose a bit of resolution, but yeah, works pretty well. I'm actually looking into oversampling or using an external ADC down the line to massively increase my accuracy of measurement.
Nice haven't used hall sensors before but sounds pretty straightforward was really just looking at voltage for now to get a rough percentage used but would be nice to measure current without a big shunt. I've been playing more with the ADC on the Arduino lately and hear you on getting a higher resolution external ADC, maybe will integrate that as well. Been just dipping into at home PCBs so fun tinkering with the components.
Shaun Husain The issue is voltage readings for battery charge are pretty terrible, at least with Lithium Ion. The voltage of Lithium Ion cells sags the more you load them. The voltage for a certain capacity @ 10A is much lower than for the same capacity at 1A. You'll get a very low percentage reading which when your system says "it's empty" will then bounce back up a bit and you realise you actually have 20%. What you can do is find a discharge graph for your cell type and create a look up table in long term storage of voltage against capacity for different load levels then use linear interpolation to work out an estimation of where you might be on those curves based on your average current load. It's kind of difficult to explain in a pinch, but if you drop to 4.1V for a 1A load and drop to 3.5V for a 10A load right at the beginning of a discharge cycle from 100%, you can use a formula that takes into account the load current, time and battery voltage to guess how charged or discharged it is. This becomes more difficult the more you vary the current over time so it's not very reliable overall, but better than a straight up single curve. You're better off doing coulomb counting like my system does but it does get difficult to keep track of the charge which has entered and left the battery. Just be careful with Lithium cells, they're pretty dangerous, make sure you have an alarm or other means of a sure thing cut off voltage so you don't go too low and permanently damage the battery. Use a reliable balance charger to charge it too.
Ross Bishop Yup so far I used a circuit simulator to show a 42-37V input and figured out what resistors and zener diodes to put in there ahead of a row of LEDs and then printed the corresponding board and wired it up and works fine for the moment. Like you said the voltage dips might be a problem I haven't actually tested it under load yet but I really just want a round about idea of how much charge the board has. Thanks for pointing out LiPo safety, I have a decent balance charger and the speed controller I use automatically starts dropping power draw at a set voltage (believe i have it at 38V right now for the 10S battery) and cuts off entirely well before the cells would be down to 3.3V. What I have as is isn't ideal cause it is draining 3W of power when the batteries are fully charged so gets quite warm (everything is rated to deal with the wattage but in a plastic container so without air cooling of motion could be a problem). Nice thing with the current setup is it's all simple components with no microcontroller. I may hook the board up to a momentary push button to get around the problem or may end up just giving in and using another micro controller :) Thanks also for the idea about accounting for the current draw while checking the voltage great idea if I end up going the micro controller route too (already an arduino in there actually).
You are so creative :o all of your projects are hightest quality, and I learned more about electronics watching your videos! Thank you for inspiring me be better electrican! ;)
Currently I'm working on a similar project, but with a different approach. I try to use an ESP8266 and a Raspberry Pi, to build some kind of distributed power measurement system, for festivals, camps, larger installations an so on. Your video really helped with suggestions regarding the use of an SD-card and a LiPo-Battery, thanks a lot! Greetings from the "Lipperland" in Germany :)
If you wrote a single text file in CSV format, you would save processing time and also time manually converting it to an Excel format afterwards as excel can open CSV (Comma-serperated variable) by default :)
greattscott you forgot to edit the adafruit library from the oled display. That is the reason why every second line of the display is blank as the library thinks youre using 128x32 and not 128x64 display.
Great video! BTW, I saw a few videos of people creating an 18650 battery capacity tester, much like what you did here. Looks something you should definitely make! :)
Insane. I had to design a similar power meter for a project at my university and without ever having watched this video I basically designed the exact same system, using the exact same components !
I really like your projects - and your videos too :). But maybe you could talk more in the end what might be coming next or include your audience actively. Maybe yo could ask something like "what shall we do next time?" - you get the point
A newer version that would support maybe 50V and 10A would be cool. That would cover not only the current USB standard but also those weird fast charging phones that use 10A.
For those who don't wanna buy or can't get the SD module, you don't need it. You can simply do a level shift with resistors (2.2k + 1k works for me) in the comunication pins (SCK, CS and MOSI). For the MISO of the SD card you can connect it directly to the Arduino as 3.3v it's logic HIGH. Of course, if you are using a 3.3v microcontroller (like the Arduino DUE) you don't need the level shift.
You will probably increase the longevity of the SD card significantly by writing the 3 values as a CSV into a single file. For true long-term use, saving up the writes and writing them once every few minutes is probably advisable.
Wayne Johnson agree also for live graphs can send the data over serial and parse and display a graph with processing.org pretty easily. Serial library there is basically the same and similar setup and loop code structure.
the sdfat32 library he was using should be able to write any simple text based file type, a csv file is a simple text based file type. and by simple text based i mean if you were to change the extension to .txt you would be able to read the contents of the file without parsing anything.
if i were you i would save the 3 files into a single csv file. you can read up on them, but here is the format you save them in. The file name should be "Your_csv_file" ".csv", and the inside of the file should be: val1a,val2a,val3a, (carriage return) val1b,val2b,val3b, (carriage return) the commas separate each value and the values are not limited to numbers, further csv files can be opened and edited by any spreadsheet program such as csv, this can make working with the data far easier.
Soumil Shah Could simply buy a "kill-o-watt" meter that plugs in between the wall and device and meters the power. To DIY I imagine make an inverter to change the AC to DC then measure that, but not simple and don't mess with mains AC if you're not sure.
What you're looking for here is a clamp on current transformer. SparkFun sells one, but I'm sure you can probably source one elsewhere. There are examples on the web for how to use these with an arduino. www.sparkfun.com/products/11005 EDIT: Here's an example of how to use one. openenergymonitor.org/emon/node/58
Sure, there are also some models that output 4-20mV, and some which can measure much higher currents, but for someone that just wants to mess around with it, the $8 option is better than the $90 option.
If you go with more expensive units, they are easier to use. There are some that have various ranges, use jumpers to set thoe ranges and output a linear voltage between 0-10v DC or 4-20mV DC for the selected range. But those are (from the limited searching I did on them) $70+. That website I linked has a better page that explains how it all works with the maths. openenergymonitor.org/emon/buildingblocks/ct-sensors-interface If you want to spend the extra cash, I've used the ACT200-42L-F model from AutomationDirect before and they work very well. Then it's just an analog read. www.automationdirect.com/adc/Shopping/Catalog/Sensors_-z-_Encoders/Current_-a-_Voltage_Sensors_(AC_-a-_DC)/Current_Transducers/AC_Current_Transducers/ACT200-42L-F
For writing values to a SD card it would be easier to separate them with a "TAB" Serial.print(value1); Serial.print('\t'); Serial.print(value2); In this way you can keep them in one file and copy them to excel. Tab will put them in a separate cells
continued... 1. replace the TimeFile, VoltFile, and curFile with DataFile = SD.open("PowerData.csv", FILE_WRITE); if (DataFile) { DataFile.print(currentMillis); DataFile.print(';'); DataFile.print(loadvoltage); DataFile.print(';'); DataFile.println(current_mA); DataFile.close(); } and 2. replace definitions with File DataFile; Hope it helps someone
Yes it can be done with this. of course YES! www.kr4.us/acs712-breakout.html?gclid=CjwKEAiAyO_BBRDOgM-K8MGWpmYSJACePQ9CSGuC2qPYgHD5p6uPwWjoMy0Rq6fF2TlAIWts7PKJ-hoCptfw_wcB
I'm sure that would work, but your measured AC is a sine wave. So you would have to make sure the sampling rate is at least twice the AC frequency (60Hz) and then use some clever math to calculate the RMS current.
Sweet. And already have two LCDs from cellphones that I took apart here. I don't really know if they are compatible with Arduono, but.. When I start studying it, I'm going to have it waiting for me. :)
How would I connect the INA219 to a solar panel if I wanted to measure the short-circuit current and open circuit voltage? A switch would be needed like a MOSFET to switch between measuring modes since the open circuit voltage is zero when measuring the short-circuit current. Would I connect everything in the same manner (besides the addition of a switch) expect my supply would be from the panel and I wouldn't add a load?
Very impressed with your video. I would like to know if you can make or discuss about a project to battery monitoring for charging and discharging of lipo batteries and also discus about the best ways of using them with out over discharging them
WELL DONE. but i have a question, if the battery is soldered to arduino, can I upload a program from the usb, or I have to put a diode between the battery and arduino?
@GreatScott I know this video is old now but it is fantastic and I've just made one of these for my leisure battery in my camper. Is it possible to calculate how long the battery will last (when it is being used) using the information from this set up? I want to keep an eye on it while I have things running. Thanks!
Hi Matt, I see your comment is quite recent, I see you say you have just made one for your camper battery, I have done one too last week but could not get it to work due to problems in compiling the sketch; it seems that it uses too much memory, I have done some research and size problem is said to be due to a bug in the compiler for Arduino 1.8.7, so I tried with arduino-1.0.6 and had indeed different results, but libraries were not compatible, I downloaded older versions of libraries but, so far to no avail. Could I ask you how you managed to get it to work ? Thanks a lot (P.S. I saw your camper video, great work!).
Ok and it's safe to use? Also what is the minimum voltage that arduino supports? P.s. Thanks for all your videos, you have an amazing resource channel :)
Actually calculation of energy is bitt wrong, if you divide power by 3600 which is 60 * 60 then the interval must be 1 sec or 1000 ms but in this case interval is 100 ms so we also have to multiply by 10 because 100 ms is 10 times smaller than 1000 ms
I always love the ideas you bring up on RUclips and instructables! Rather than buy a power meter, I think I will build based on your design. I can assume you will be publishing another 'ible for this?
Could you really used electret condenser microphone to harvest acoust to electrical energy enough to power cellphones or Leds? I read a paper being published. Was it really true?
@@j4mm3r61 that paper I was talking about was authored with a doctoral degree. He just doesn't disclose all the tiny bit information but emphasize the 9 parallel connected electret condenser microphone and convert to DC by bridge rectifier and some other things with Arduino then voila he was able to charge phones
that is so cool!!! but I am wondering if a larger display is available? and if it can be adapted for much higher current? and use something like a toroidal current sensor ? ( I have seen them. but not sure what they are called) I have seen them used with 0gauge cable through them. to read current. I would like to use a setup like this for a off grid solar power system. so I guess it would need to be capable of reading up to 30 volts also. I was thinking of just buying meters. but this is way cooler. I guess it would need to read like 300-400 amps. thanks . this was a great video..
Don t you need a voltage regulator after the battery so as to get a decent 5v voltage for the arduino ? Otherwise the voltage will drop out to 2.5 before the protection circuit cuts it Thanks !
The best part about this video for me was the project file on easyeda. Not because I want to build this myself, but because I kept searching for a website like that and it is really useful for me. Thanks.
No problem ;-)
A smart engineer with a German accent makes his own power meter/logger but when not satisfied with just an oled screen, adds a data logger too, Great Job!!!
GS, This is one fantastic project. Made one and even added a few mods to the code.
I didn't have to buy anything new or substitute. I had everything already and was going to design and code this exact design from scratch, but you did all the hard work for me, and I thank you for it. Also, thank goodness for these cheap modules.
This and many other projects would not have even been possible only 5-10 years ago, without these cheap and wonderful modules from China.
learned more from your channel in the past month than an entire year in school love your channel!
Wow, I just realized how much time and effort it must take to make these videos.
And this is only 6-7 minutes long. Damn.
I'm really glad you took your time to properly design the board and have it compact and neat
for the logging you can use an CSV file and open it with format and it's pretty easy to create for example per each line you can have:
TIME,VOLTAGE,CURRENT
just use comma (, ) as separator between you values and excel should be able to put them in column for you
Perfect. This is exactly what I am looking for to experiment with small garden wind generators and other projects. Thanks for showing me the way.
I love the INA219 module. I once used one to replace an expensive stepper motor with a far-cheaper and more powerful 12VDC gear motor. I had a n arm on the shaft of the motor, and I just blocked it so that it could not turn past the points where I wanted it to stop. Then I would start the motor turning and monitor the current. When the arm hit the block, the motor would start taking more current, and I would know it was time to shut it off. It was self-calibrating! It worked perfectly once I thought to drop a little super glue on the flange and motor shaft, because the motor was so powerful the flange set screws were not enough.
Hint for your data logging: Have your Arduino log all data to a .csv file. Each line is a row of data, separated by commas, and you can even have the Arduino do some of your calculations for you and include them on the line. Stick the SD card into your computer, double-click the .csv file, and it opens up in Excel, each data point in it's own cell, nice neat rows and columns. Select a column, select "Insert", and insert a graph of the data, easy-peazy.
Lastly, I know this video was created four years ago, but we now have some data logger modules. I got two of the ones you just plug an Arduino Nano into, and I got one of them working yesterday. The module gives you everything pre-wired, including a real time clock module. So you can time-stamp your data in the .csv file, you just need two more commas and columns, and you can see when that spike occurred. I like this data logger. I intend to program it to accept a string from another Arduino and log it, with a time stamp, to a .csv file. The string will be a pre-formatted string sent via SoftwareSerial.h. That way I have the complexity and memory requirements of the RTC and SD card set aside from the Arduino doing the real work, leaving precious memory for other things.
Thank you so much for this video and saying to use SdFat library. I have lost a lot of time, not knowing why I could not open a file on a SD card with a Chinese SD module and the SD library. I found nothing about it on many forums. Now it works ! GREAT !!
Great video. The resolution of the OLED display is not set correctly though. It is not set to the maximum resolution. Edit the library file in order to set the correct resolution 128x64 pixels .
@@ChoudryArif it's not hardware. I thought the same, and after 5 hours of troubleshooting I finally found the solution. You need to change a line of code from the library itself. Either way the display will work at half resolution, even if you change it from de IDE
@@BnMroGaming I don't know if the memory has been upgraded on the current models of the arduino, but from what I saw on the instructables site, they ran in on the 128X32 because of memory limitations. The 128X64 used too much.
@@BnMroGaming hey lets talk i need your fb
RUclipsrs like you make me want to get a degree in electronics engineering!
I really like this one, I managed to buy all the modules for less than 5 bucks. I already have an UNO lent to us by our teacher.
I needed this last year and just abandoned the project, (cause I'm a beginner and couldn't find how to do it) will resume it in a few weeks when I have time. Thank you!
I really liked the way he skimmed over the code, It's nice to see the code without downloading the file :D.
Awesome video, I really like how you created the data logger for power consumption, this will prove really useful for evaluating and diagnosing battery life.
I like that little character/dot display you're using
Wonderful approach to build a custom power meter
Nice video! Tips: Output it into a csv formatted file instead and you can directly open it into any program suitable. Then you dont have to copy paste the rows :)
Just got all my parts in the mail today. I'm going to rig one of these up.
congrats on 420k subs
oh dank
instead of writing it to a file and graphing via excel, i would rather send all data via UDP to influxdb and have real time graph using grafana, apart of this part, awesome video, thanks a ton !!!! Helped me so much
This is a very good project for measure DC power comsumption, and have a better estimation of how long a battery powered circuit will last. But not to calculate how much will cost you to charge your smartphone, for exmaple (0:25), because you are not measuring the AC power comsumption and you can't even estimate it because you don't know the power factor of your charger.
Your channel is amazing!!!! Thank you so much for being around!!
Great vidio. Here is a suggestion for your next project: build a quad or make a wireless headphones with one of the bluetooth audio reciever
Your SdFat really solved the same problem...Lot of thanks Great Scott!!
Happy holidays, always quality content here, nice project
Thanks :-)
This is yet another class project.
Danke für die Screenvideos beim Programmieren und PCB Layout, sehr angenehm
A german comment.
Your OLED library is set on 128×32. Check the library (.h file) comment the line that defines (#define) the 128×32 resolution mode and uncomment the line with 128×64 :)
You should modify the sketch to create a single CSV file (current, voltage and time separated by comma or semicolon), so you wouldn't have to copy the 3 txt files to Excel, but you could easily open with it, and create diagrams out-of-the-box. :)
GreatScott! Nice explanation and a beautiful simple integration project.
I Like!
I think this is one of your best Scott. Thank you
I just started a similar build some days ago using a Pro Mini, ACS712 current sensor and the same OLED. Since I mostly record to my PC anyway my unit is powered using a USB port (thats not the input-port but a dedicated one) which also sends current values to the connected PC for display and recording. I opted to use the internal 1.1V reference instead on VCC, so changes in the PCs supply voltage don't offset the ADC that much. You might want to check this on your build if you connected the battery directly to VCC - afair VCC is used as the default reference for the ADC so your measurements might get skewed with falling battery voltage. Using the 1.1V also allowed me to dynamically scale for
BitBastelei Hey
Gar nicht erwartet dich hier zu sehen👋
There is an issue with the energy calculation in the sketch.
The value being added to the total energy consumed has to consider the interval at which measurements are made. The interval is set in milliseconds, so a variable or constant for "measurementsPerHour = 3,600,000 / interval" has to be used as the divider when adding to the energy displayed in mWh.
To provide an example using the 100ms interval used in the sketch: measurementsPerHour = 36,000
Now given 650mW for example, each interval adds 0.0186mWh to the energy total.
It's strange that it's only comment like that, a lot of people made this project and no one noticed wrong calculations. I had 6 wh instead 1.5 when i dig in i found that it's doesn't correspond to the time
I appreciate this comment was a long time ago, but my code is based off this video and I found the same problem, although i've found even though the interval is set to 100ms I only get an accurate wh reading if I divide by ~410ms intervals: (energy = energy + (power / 8780.4878);) is there a limit to the sample rate of the INA219? I thought it was supposed to be capable of ~14 samples a second (~every 71ms)
Thanks for keeping me creative and sure you will see me next time !
I'm working on an expanded version of this for a project I'm working on :)
Tracks a whole bunch of statistics for lithium ion battery management, coulomb counting, battery capacity over time, voltage cut off etc. I've been toying with the idea of adding an OLED display and SD card reader (this primarily so I can avoid writing to EEPROM too much).
After watching your video I may just add these :D
Ross Bishop sweet have a very simple version of a power meter for a 10S battery on a skateboard. I used a bunch of zener diodes but in hindsight it burns quite a bit of power so thinking maybe voltage divider first then measure, any thoughts/ideas?
To measure the current? A hall sensor if you can grab one, I'm using one of the ACS712 jobbies you can get on eBay for a few quid.
The 20A version outputs 100mV/A above about a 2.5V float voltage (I'm using a 5V Arduino Nano like in this video) and you can get down to 50mA resolution with the 10 bit ADC. There's a readily available 30A one too, 66mV/A so not quite as nice to work with and I think you might lose a bit of resolution, but yeah, works pretty well.
I'm actually looking into oversampling or using an external ADC down the line to massively increase my accuracy of measurement.
Nice haven't used hall sensors before but sounds pretty straightforward was really just looking at voltage for now to get a rough percentage used but would be nice to measure current without a big shunt. I've been playing more with the ADC on the Arduino lately and hear you on getting a higher resolution external ADC, maybe will integrate that as well. Been just dipping into at home PCBs so fun tinkering with the components.
Shaun Husain The issue is voltage readings for battery charge are pretty terrible, at least with Lithium Ion. The voltage of Lithium Ion cells sags the more you load them. The voltage for a certain capacity @ 10A is much lower than for the same capacity at 1A. You'll get a very low percentage reading which when your system says "it's empty" will then bounce back up a bit and you realise you actually have 20%.
What you can do is find a discharge graph for your cell type and create a look up table in long term storage of voltage against capacity for different load levels then use linear interpolation to work out an estimation of where you might be on those curves based on your average current load.
It's kind of difficult to explain in a pinch, but if you drop to 4.1V for a 1A load and drop to 3.5V for a 10A load right at the beginning of a discharge cycle from 100%, you can use a formula that takes into account the load current, time and battery voltage to guess how charged or discharged it is. This becomes more difficult the more you vary the current over time so it's not very reliable overall, but better than a straight up single curve.
You're better off doing coulomb counting like my system does but it does get difficult to keep track of the charge which has entered and left the battery.
Just be careful with Lithium cells, they're pretty dangerous, make sure you have an alarm or other means of a sure thing cut off voltage so you don't go too low and permanently damage the battery. Use a reliable balance charger to charge it too.
Ross Bishop Yup so far I used a circuit simulator to show a 42-37V input and figured out what resistors and zener diodes to put in there ahead of a row of LEDs and then printed the corresponding board and wired it up and works fine for the moment. Like you said the voltage dips might be a problem I haven't actually tested it under load yet but I really just want a round about idea of how much charge the board has.
Thanks for pointing out LiPo safety, I have a decent balance charger and the speed controller I use automatically starts dropping power draw at a set voltage (believe i have it at 38V right now for the 10S battery) and cuts off entirely well before the cells would be down to 3.3V.
What I have as is isn't ideal cause it is draining 3W of power when the batteries are fully charged so gets quite warm (everything is rated to deal with the wattage but in a plastic container so without air cooling of motion could be a problem). Nice thing with the current setup is it's all simple components with no microcontroller. I may hook the board up to a momentary push button to get around the problem or may end up just giving in and using another micro controller :)
Thanks also for the idea about accounting for the current draw while checking the voltage great idea if I end up going the micro controller route too (already an arduino in there actually).
You are so creative :o all of your projects are hightest quality, and I learned more about electronics watching your videos! Thank you for inspiring me be better electrican! ;)
Man... I am happy to find your channel. Great videos!
What can I say , simply clever , thank you again Scott
Currently I'm working on a similar project, but with a different approach. I try to use an ESP8266 and a Raspberry Pi, to build some kind of distributed power measurement system, for festivals, camps, larger installations an so on.
Your video really helped with suggestions regarding the use of an SD-card and a LiPo-Battery, thanks a lot!
Greetings from the "Lipperland" in Germany :)
Thanks! This is exactly the type of system I need for monitoring battery charge and discharge times. I plan to use the larger 2.42" OLEDs.
If you wrote a single text file in CSV format, you would save processing time and also time manually converting it to an Excel format afterwards as excel can open CSV (Comma-serperated variable) by default :)
This is a really great little project !
exactly what I've been looking for mate... awesome, will keep you posted
greattscott you forgot to edit the adafruit library from the oled display. That is the reason why every second line of the display is blank as the library thinks youre using 128x32 and not 128x64 display.
Thanks for telling me. I will have a look at it.
sabes como se debe arreglar la libreria, no entiendo como hacerlo.. porfavor ayuda
Great video! BTW, I saw a few videos of people creating an 18650 battery capacity tester, much like what you did here. Looks something you should definitely make! :)
How come multimeter refresh rates are so low compared to this? This was cheap and fast, most high end multimeters measure a lot slower than this.
chems Hey, Osama!
Insane. I had to design a similar power meter for a project at my university and without ever having watched this video I basically designed the exact same system, using the exact same components !
Now this is an excellent project!
I really like your projects - and your videos too :). But maybe you could talk more in the end what might be coming next or include your audience actively. Maybe yo could ask something like "what shall we do next time?" - you get the point
A newer version that would support maybe 50V and 10A would be cool. That would cover not only the current USB standard but also those weird fast charging phones that use 10A.
Your Videos Are Amazing!!
The Camera movement is professional
That's awesome DIY project for your video list.
I will try this one. Thanks to uploaded it.
For those who don't wanna buy or can't get the SD module, you don't need it. You can simply do a level shift with resistors (2.2k + 1k works for me) in the comunication pins (SCK, CS and MOSI). For the MISO of the SD card you can connect it directly to the Arduino as 3.3v it's logic HIGH. Of course, if you are using a 3.3v microcontroller (like the Arduino DUE) you don't need the level shift.
Congrats on 434,571 Subs haha
Great stuff Great Scott!
You will probably increase the longevity of the SD card significantly by writing the 3 values as a CSV into a single file. For true long-term use, saving up the writes and writing them once every few minutes is probably advisable.
Easier to create CSV file DATA.csv and comma separated values.
That's what I came here to say :)
I thought exactly the same.
Wayne Johnson agree also for live graphs can send the data over serial and parse and display a graph with processing.org pretty easily. Serial library there is basically the same and similar setup and loop code structure.
the sdfat32 library he was using should be able to write any simple text based file type, a csv file is a simple text based file type. and by simple text based i mean if you were to change the extension to .txt you would be able to read the contents of the file without parsing anything.
nerds
if i were you i would save the 3 files into a single csv file. you can read up on them, but here is the format you save them in. The file name should be "Your_csv_file" ".csv", and the inside of the file should be:
val1a,val2a,val3a, (carriage return)
val1b,val2b,val3b, (carriage return)
the commas separate each value and the values are not limited to numbers, further csv files can be opened and edited by any spreadsheet program such as csv, this can make working with the data far easier.
Awesome video Scott!
For those kind of small oled screens, I would strongly suggest to use the Libgdx library rather than the adafruit one.
Hey how about measuring power of ac appliance how can we modify current project and measures ac voltage and current
Soumil Shah Could simply buy a "kill-o-watt" meter that plugs in between the wall and device and meters the power. To DIY I imagine make an inverter to change the AC to DC then measure that, but not simple and don't mess with mains AC if you're not sure.
What you're looking for here is a clamp on current transformer. SparkFun sells one, but I'm sure you can probably source one elsewhere. There are examples on the web for how to use these with an arduino.
www.sparkfun.com/products/11005
EDIT: Here's an example of how to use one.
openenergymonitor.org/emon/node/58
Sure, there are also some models that output 4-20mV, and some which can measure much higher currents, but for someone that just wants to mess around with it, the $8 option is better than the $90 option.
Pete Brubaker hey i think interfacing of current transform is quite complicated isn't??
Can anyone make a video tutorial on that
If you go with more expensive units, they are easier to use. There are some that have various ranges, use jumpers to set thoe ranges and output a linear voltage between 0-10v DC or 4-20mV DC for the selected range. But those are (from the limited searching I did on them) $70+. That website I linked has a better page that explains how it all works with the maths.
openenergymonitor.org/emon/buildingblocks/ct-sensors-interface
If you want to spend the extra cash, I've used the ACT200-42L-F model from AutomationDirect before and they work very well. Then it's just an analog read.
www.automationdirect.com/adc/Shopping/Catalog/Sensors_-z-_Encoders/Current_-a-_Voltage_Sensors_(AC_-a-_DC)/Current_Transducers/AC_Current_Transducers/ACT200-42L-F
I love his hand writing
GREAT SCOTT! ( I love that expression ) Another fantastic video.
For writing values to a SD card it would be easier to separate them with a "TAB" Serial.print(value1); Serial.print('\t'); Serial.print(value2);
In this way you can keep them in one file and copy them to excel. Tab will put them in a separate cells
continued...
1. replace the TimeFile, VoltFile, and curFile with
DataFile = SD.open("PowerData.csv", FILE_WRITE);
if (DataFile) {
DataFile.print(currentMillis);
DataFile.print(';');
DataFile.print(loadvoltage);
DataFile.print(';');
DataFile.println(current_mA);
DataFile.close();
}
and 2. replace definitions with File DataFile;
Hope it helps someone
Could you hook up a current transformer, like 150:5 amp, to this and use it safely, and set it up for A/C?
+Hangfire of course NO! This current monitor can handle just DC I guess max 26 v and 3.2 Amp
Yes it can be done with this. of course YES!
www.kr4.us/acs712-breakout.html?gclid=CjwKEAiAyO_BBRDOgM-K8MGWpmYSJACePQ9CSGuC2qPYgHD5p6uPwWjoMy0Rq6fF2TlAIWts7PKJ-hoCptfw_wcB
+Hangfire haha OK! But I'm not sure about the voltage there (is it 120 or 220v?).
Any way u can try and give us a feedback ;)
GOODLUCK
I'm sure that would work, but your measured AC is a sine wave. So you would have to make sure the sampling rate is at least twice the AC frequency (60Hz) and then use some clever math to calculate the RMS current.
yes!! that's the great project
Thanks ;-)
Nice work. You build beautiful diagrams
Think your videos are great and I'd love to see your take on homemade automated blinds. Stay chill
great project sir! very much innovative and out of the box
Why didn't you consider using ACS712 modules that are capable of measuring even higher values of currents?
2:57 can you please explain why there is around 1V without any load and if there is a way to avoid this? thank you!
In a future video can you make a multimeter wich is like the Mooshimeter? It would be a really big help! :D
Dávid Illyés have you been watching ElectroBoom? 😂
Yapp :D
can you do a quick video on how you do such clean solder bridging and stuff on the back of the board?
this is awesome, thanks for the sharing. especially the sdfat library.
Sweet. And already have two LCDs from cellphones that I took apart here. I don't really know if they are compatible with Arduono, but.. When I start studying it, I'm going to have it waiting for me. :)
How would I connect the INA219 to a solar panel if I wanted to measure the short-circuit current and open circuit voltage? A switch would be needed like a MOSFET to switch between measuring modes since the open circuit voltage is zero when measuring the short-circuit current. Would I connect everything in the same manner (besides the addition of a switch) expect my supply would be from the panel and I wouldn't add a load?
Subbed only because of his great accent!!!
I LOVE your channel.
Great Video.
Would you mind explaining why you changed from a "nano" to "mini" ?
To save space and money.
GreatScott! I see, thank you
Very impressed with your video.
I would like to know if you can make or discuss about a project to battery monitoring for charging and discharging of lipo batteries and also discus about the best ways of using them with out over discharging them
I am always waiting for your videos
Keep going :)
WELL DONE. but i have a question, if the battery is soldered to arduino, can I upload a program from the usb, or I have to put a diode between the battery and arduino?
Amazing video !
This is what you call a real "DIY"
@GreatScott
I know this video is old now but it is fantastic and I've just made one of these for my leisure battery in my camper.
Is it possible to calculate how long the battery will last (when it is being used) using the information from this set up?
I want to keep an eye on it while I have things running.
Thanks!
Hi Matt, I see your comment is quite recent, I see you say you have just made one for your camper battery, I have done one too last week but could not get it to work due to problems in compiling the sketch; it seems that it uses too much memory, I have done some research and size problem is said to be due to a bug in the compiler for Arduino 1.8.7, so I tried with arduino-1.0.6 and had indeed different results, but libraries were not compatible, I downloaded older versions of libraries but, so far to no avail. Could I ask you how you managed to get it to work ? Thanks a lot (P.S. I saw your camper video, great work!).
Excellent video
But when you power your arduino with the lipo battery, did you use a 5v boost converter or a 3.3v arduino model?
I did not use a boost converter nor a 3.3V version.
And how did you managed to power on your 5v arduino with a voltage of 2.7-4.2 v?
*****
By not using the voltage regulator.
Ok and it's safe to use? Also what is the minimum voltage that arduino supports? P.s. Thanks for all your videos, you have an amazing resource channel :)
Visit Arduino website. All information you seek is there!
Actually calculation of energy is bitt wrong, if you divide power by 3600 which is 60 * 60 then the interval must be 1 sec or 1000 ms but in this case interval is 100 ms so we also have to multiply by 10 because 100 ms is 10 times smaller than 1000 ms
Wouldn't it make more sense to use the native 3.3V version of the Pro Mini so you wouldn't need the level shifter on the SD card board?
slight correction, in order to measure current you need to be in parallel with the shunt resistor
I always love the ideas you bring up on RUclips and instructables!
Rather than buy a power meter, I think I will build based on your design. I can assume you will be publishing another 'ible for this?
Very Nice Work! Congratulations!
Can you please share how we can measure energy consumption of household appliances like refrigerator or Air conditioner? Thanks in advance
Could you really used electret condenser microphone to harvest acoust to electrical energy enough to power cellphones or Leds?
I read a paper being published. Was it really true?
There is acoustic energy, but it can produce way less electric energy, than like smallest world LED would need, so that was definitely fake.
@@j4mm3r61 that paper I was talking about was authored with a doctoral degree. He just doesn't disclose all the tiny bit information but emphasize the 9 parallel connected electret condenser microphone and convert to DC by bridge rectifier and some other things with Arduino then voila he was able to charge phones
dude, i love your video. it help a lot of people :)
that is so cool!!! but I am wondering if a larger display is available? and if it can be adapted for much higher current? and use something like a toroidal current sensor ? ( I have seen them. but not sure what they are called) I have seen them used with 0gauge cable through them. to read current. I would like to use a setup like this for a off grid solar power system. so I guess it would need to be capable of reading up to 30 volts also. I was thinking of just buying meters. but this is way cooler. I guess it would need to read like 300-400 amps. thanks . this was a great video..
Don t you need a voltage regulator after the battery so as to get a decent 5v voltage for the arduino ?
Otherwise the voltage will drop out to 2.5 before the protection circuit cuts it
Thanks !
I have the same question...
Very Nice , Thanks GreatScott!