#13 Automated Battery Tester with an Attiny85 and an OLED (Tutorial)

Поділитися
Вставка
  • Опубліковано 3 лис 2024

КОМЕНТАРІ • 211

  • @alvarobravok
    @alvarobravok 5 років тому +4

    One of the most useful yet simple DIY gadgets built, Thanks Andreas!

  • @einars899
    @einars899 6 років тому

    I did a project for a customer way back in time. They could not describe the function of an alarm in a way that I could do in 74xxx logic and be sure they would approve it after testing. So I used an ATTiny, and sure enough, after testing they found out I was right, the specs were not describing what they meant. But I did not have to redo the board layout, just reprogram the microcontroller within a day or two. As a bonus the component count and cost were lower than if I used 74xxx logic.
    No cost escalation or time penalty. Customer happy, my company happy, me happy, life is good.
    And another thumbs up to you as usual.

    • @AndreasSpiess
      @AndreasSpiess  6 років тому

      Thanks for your support! I also prefer an ATtiny because of the reasons you describe.

  • @JanPaulini
    @JanPaulini 3 роки тому

    Thank you SO much for the TinyOzOLED library, I was stuck for hours before trying to squeeze other libraries in before I came across this Video. Thanks again and greeting from Ireland.

  • @MrAbrandao
    @MrAbrandao 4 роки тому

    Very instructive. The real magic is in how do you find those fantastic librarys...

  • @df9999999999
    @df9999999999 7 років тому +1

    After a lot of fooling with trying to get an accurate current and ESR reading, I must say you are correct. The simple circuit simply cannot measure current very well. I can get reasonable ballpark current and ESR calculations, but they are not accurate and really don't add much useful information. The main purpose is to show no load/loaded battery voltage and it does this very well. Knowing the precise load is really not that important for that purpose.
    Regarding whether the ADC reference voltage need to be divided by 1024 or 1023, I have concluded your 1023 works better as it avoids the rounding error that prevents measuring up to and including the Vref if 1024 is used.
    The only changes I made now is using smaller numbers for my 2-color display and pulling out the current measurement code and ADC connection, as it is not used in the voltage calcs.
    A very useful circuit!

  • @vinceherried497
    @vinceherried497 8 років тому +9

    I just noticed your stabilization code may have an error.
    you have not initialized the values for
    int emptyRaw ;
    int emptyOld ;
    I assume they get set to 0.
    then in your stabilization routine you have
    // wait till value stable
    while (abs(emptyRaw - emptyOld) > 3) {
    emptyOld = emptyRaw;
    emptyRaw = analogRead(ADCVOLT);
    }
    Seems to me that if the two values are truly initialized to zero, the while loop will never run?
    If I understand the while loop it is tested at the beginning so I think you should have coded
    do {
    blah blah
    } while ( the test );
    no ?
    ------
    I really enjoy watching and learning from your videos Keep it up.

    • @AndreasSpiess
      @AndreasSpiess  8 років тому +4

      You are right! I corrected it. Thanks.

  • @melisawhitt8360
    @melisawhitt8360 7 років тому +2

    i have looked for days for a good working example and i I found a few ..But I cant get them to work you explain things very well
    I was hoping you had used I2C with attiny85 and a two or four line LCD

  • @jon_raymond
    @jon_raymond 9 років тому +1

    Great video. Very informative and I love using the Oled displays. Keep up the excellent work!

    • @AndreasSpiess
      @AndreasSpiess  9 років тому +1

      +Jon Raymond Thany you for your comment. Such comments make it easy to continue my work!

  • @englishrupe01
    @englishrupe01 5 років тому +1

    Great job! Thanks for all your work Andreas!

  • @planker
    @planker 3 роки тому

    Yes, Thanks. This is something Super cool. I have been exploring the Nano, I did not know about ATtiny85. I just ordered a 5 pack. Exactly what I have been wanting. Nice! I will clean up the bench and make ready for the new arrivals.

    • @AndreasSpiess
      @AndreasSpiess  3 роки тому

      The ATTiny is a nice addition to his bigger sisters...

  • @DavidJJJ
    @DavidJJJ 7 років тому +2

    Thanks, this is an awesome project! To be able to do such a task with a tiny chip.

  • @df9999999999
    @df9999999999 7 років тому +3

    Andreas, I finally built up your battery tester circuit on a board for regular use. I did change the display portions of the code to suit a 2-color OLED display that I had on hand, but otherwise the sketch works as you wrote. I did eliminate the current measurement part of the sketch as it was not being used and eliminated one connection to the ATTINY85. This thing is very handy!
    Oh, I also switched the location of the MOSFET and load resistors as shown in your schematic so that the source is connected directly to ground, allowing for more reliable switching of the MOSFET.
    My video is at: ua-cam.com/video/ZNbV6Nkpp6Y/v-deo.html

  • @shadowwalker23901
    @shadowwalker23901 8 років тому

    With a slight modification to the code, you could display the ESR of the battery, as all that is needed is normal voltage, voltage under load and the current under load to get the ESR. You already have that information in your device.

    • @AndreasSpiess
      @AndreasSpiess  8 років тому

      +Cory Marshall Thank you for this proposal. This should really be easy to be done.

    • @shadowwalker23901
      @shadowwalker23901 8 років тому

      +Andreas Spiess here is a link to a energizer technical bulletin of performing a ESR test. data.energizer.com/PDFs/BatteryIR.pdf Hope this helps.

  • @arduinomasterrobertmoller2904
    @arduinomasterrobertmoller2904 7 років тому +3

    I meant if you could make this as part of your next video, as the software is the hardest to do even on such simple project like this one. I like to see more ATiny projects in general.
    PS: Could not find you on Patreon.com to become a subscriber.

    • @AndreasSpiess
      @AndreasSpiess  7 років тому

      I do not think I would use an ATtiny for such a project because it would not reduce the size of the whole build. I rather would use a Arduino pro mini or an ESP8266 for that. I like ATtinies and use them, when the build is simple and has to be small. For the moment, I have no pending project with this MCU. But you find a few other videos where I used one: ua-cam.com/play/PL3XBzmAj53RkNmqp5htIPXAXcrYf3gbtV.html

  • @clearwavepro100
    @clearwavepro100 7 років тому +1

    Very interesting, so Thank You for sharing your work with us and excellent communication, pacing and style too :)

  • @gnosallhistory
    @gnosallhistory 9 років тому

    Great video. I have a number of inexpensive USB rechargeable Powerbank battery packs which don't indicate what power is left in them. Can the same circuitry be used and are software changes required to read the approx. 5 volts. Your advice will be appreciated. Bob

    • @AndreasSpiess
      @AndreasSpiess  9 років тому +1

      +Bob Johnson In principle: Yes. I would even extend the usage. If you decide on a particular load you could charge your lipo completely, connect this particular resistor to the LIPO and discharge it once completely with this load resistor. If you measure the voltage from time to time, you get the characteristic curve. If your arduino knows this curve, it could show you exactly the remaining percentage. But pay attention, your resistor for the discharging experiment has to carry a big load. The resistor on my power meter on the other hand can be very small because it is only switched on for milliseconds.

  • @alphonsesynrem28
    @alphonsesynrem28 6 років тому +1

    Dear Sir, I have build this using pro mini and the display is Nokia 5110. How can I show you the picture of my battery esr meter. Using voltage divider to measure till 15 volts. Load current element, 10ohm and irfz44. Accuracy 5/1024 still.

    • @AndreasSpiess
      @AndreasSpiess  6 років тому

      You can post links here in the comment. Or you send me a Facebook message.

  • @salukikev
    @salukikev 8 місяців тому

    It seems that it would be simple to also add a feature to display resistance to a test circuit. That way you could have a tiny, very basic DVM. Do you agree?

    • @AndreasSpiess
      @AndreasSpiess  8 місяців тому

      Yes, but a very limited one.

    • @salukikev
      @salukikev 8 місяців тому

      @@AndreasSpiessClearly the display is limited but is there a significant limitation to the range or sensitivity to resistance? VDC & resistance are the two most commonly used features of any DVM of course. I was considering a project very similar to yours but including resistance.

  • @Tango-bv1pn
    @Tango-bv1pn 4 роки тому

    HI Andreas, great work, maybe can just add an extra line in OLED to check the Internal Resistance (Voltage Drop/Current) and display the value in mili Ohm.

    • @AndreasSpiess
      @AndreasSpiess  4 роки тому +1

      Maybe you add it and create a pull request on GitHub?

  • @ehsankeshtgar6734
    @ehsankeshtgar6734 9 років тому +2

    Great job and excellent explanation . I've been searching for tutorial how to work with my OLED display along with Attiny85. this video helped me a lot.thanks
    May I have a question , you might can help me with it ?!
    I am trying to read temp from BMP085 and display it in OLED all by Attiny85.
    BMP085 and OLED both working with the same SDA and SCL pins in Attiny85 , so I am not sure how to send data by sensor and read them from the same ports in Attiny85. any help would be appreciated . Thanks

    • @AndreasSpiess
      @AndreasSpiess  9 років тому +2

      +Ehsan Keshtgar Thank you for your comment! I2C (SDA/SCL) bus is made to connect many different devices to the same wires. This is why it is called "bus" . Otherwise it would be called "connection". So it is no problem if you connect both devices to the same wires. SCL to SCL and SDA to SDA. This is possible if all connected devices use different addresses. To find this out, you can let your adrduino check it. Connect each device independently to your Arduino (not Attiny) and start a small "Multispeed Scanner" sketch. The details are here:
      forum.arduino.cc/index.php?topic=197360
      Your Arduino should show you the address of each device and you can check if they are different. If not, you often have the possibility to change the address of one device or the other (on the device itself). Then it should work.
      If not, you might have another issue: Termination. Busses have to be "terminated" wich means, you have to connect a resistor betwenn each signal wire and VCC. If needed you find information about this using Google. But I think, in your case it might not be necessary.
      If I have time next week I try it myself and make a small video about it.

    • @AndreasSpiess
      @AndreasSpiess  9 років тому +3

      +Ehsan Keshtgar I took your question as a reason to create two videos about the issue. Maybe it is helpful. I anyway had to connect two different displays on one I2C bus for my power meter project...

    • @ehsankeshtgar6734
      @ehsankeshtgar6734 9 років тому

      +Andreas Spiess , Thank you very much for your help. it helped me a lot and I could manage to fix the issue.As you explained , I connect both pressure sensor and OLED display to the same SDA and SCL ports and its working fine. I also used pin3 and 4 as digital output for LEDs all in Attiny85.
      Thanks again for your time and I hope to see more videos from you :-)

    • @ehsankeshtgar6734
      @ehsankeshtgar6734 9 років тому

      +Andreas Spiess Thanks . Could you please provide links to your new videos.Merci.

    • @AndreasSpiess
      @AndreasSpiess  9 років тому

      +Ehsan Keshtgar Yes, I can...
      Two equal displays: ua-cam.com/video/j6B47reye80/v-deo.html
      Many devices in one bus: ua-cam.com/video/QQLfzlPGjjE/v-deo.html
      I am glad to hear that it works now for you!

  • @norm1124
    @norm1124 9 років тому

    Hallo Andreas, Grüße aus Bern, wohl nach Basel. Ich programmiere die attiny jeweils mit dem ARDUINO ISP. Interessantes Projekt, danke für das Vorstellen und bis zum nächsten Mal.

    • @AndreasSpiess
      @AndreasSpiess  9 років тому

      norm1124
      Vielen Dank für deinen Kommentar. Hatte ich früher auch so gemacht. Irgendwann wollte ich den Aufbau nicht mehr jedesmal machen. Deshalb habe ich mir zwei kleine Platinen gebaut, eine für die 85er und eine für die 84er und mir einen USBASP besorgt. Werde in einem späteren Video vielleicht mal drüber berichten...

    • @lerrypage
      @lerrypage 6 років тому

      Hallo Andreas! Ich verfolge immer sehr interessiert deine Projekte. Da ich auch gerne mit den Attinys arbeite hab ich nun auch en Projekt mit einem Oled-Display realisiert und da ist mir das Flackern deiner Anzeige störend aufgefallen, weshalb ich zum Tiny4kOLED Library gewechselt hab und damit gut klar komme. Hier ein kurzes Video davon:
      ua-cam.com/video/90n8DULNCxY/v-deo.html
      Schöne Grüße aus dem Norden Österreichs!

  • @CarlosSantos-rt7cp
    @CarlosSantos-rt7cp 4 роки тому

    nice project. that analog meter you show in the begining could be replaced with a digital one with a 0.91 display showing a bar meter with top scale .I would do one but im still very green in programing...

    • @AndreasSpiess
      @AndreasSpiess  4 роки тому +1

      This might be a good project to start with...

  • @Gitesson
    @Gitesson 8 років тому

    Hi, great channel! At the end of the video you mentioned about PCB milling. Are you still planning to make some video about it?

    • @AndreasSpiess
      @AndreasSpiess  8 років тому +1

      +Bartłomiej Czerwiński Thank you! Yes, I have it on the list. But it will be several episodes from Eagle via my "toolchain" to the milling of the board. And I would also like to include all the enhancements I did to my cheepo 6040 CNC router...
      But it is definitively on the list.

  • @ezeprojects5425
    @ezeprojects5425 5 років тому

    Hello. I've enjoyed this video very much, especially connecting attiny8

    • @ezeprojects5425
      @ezeprojects5425 5 років тому

      Did not get to finish. attiny85. But I am wanting to incorporate a bigger alphabet, and cannot figure out how to get a littler bit bigger font. Can you help? where did you get your big number font? Thx.

    • @AndreasSpiess
      @AndreasSpiess  5 років тому

      I only know the fonts I used. They have to be crafted by hand.

  • @AeroBikeeu
    @AeroBikeeu 5 років тому

    Hello, not sure attiny85 is powered at 5vcc or 3.3v to be compatible with Oled sda scl lines? Unsure, whether those Oled i2c interface expects 3.3v max since ssd1306 Oled chips seams to have such maximum electrical limits in datasheet? Trying to do the same right now ;)

    • @AndreasSpiess
      @AndreasSpiess  5 років тому +1

      Check if your OLEDs are 5 volt resistant in the specs (usually, they are). Then you can decide. the ATTiny works on both voltages.

  • @youpattube1
    @youpattube1 2 роки тому

    I have learned quite a bit while trying to understand what you did and why you did it. Is it fair to say that if you measure 1.1v using an internal 1.1v reference you will get about 1.1v. But if you had stayed with the standard 5v reference, you would measure about 0.86v ?

    • @AndreasSpiess
      @AndreasSpiess  2 роки тому

      The ATtiny has a 1.1 volt reference because it runs on 5V power. References cannot be the same voltage.

    • @youpattube1
      @youpattube1 2 роки тому

      @@AndreasSpiess I formed my question badly. In your code you changed analogReference from Standard 5v to INTERNAL 1.1v. As I understand it this yields higher resolution. But that term has little meaning to me. So I set out to see if there was a voltage measurement outcome difference. One measurement using A.R. 5v, and one use A.R. 1.1v (using atTiny or Nano is the same I believe). If I could see a difference, then I could understand why you changed the A.R.
      I hope that I have explained myself better. The bottom line is, if you measure a battery with no load using an analogReference of 5v, what would you read if A.R. was then set to 1.1v ? Let's say in the first instance you measured 1.0v no load battery voltage. I may have confused things by using a battery voltage of 1.1v in my question.

    • @AndreasSpiess
      @AndreasSpiess  2 роки тому

      @@youpattube1 As mentioned, the ATTiny has no 5V reference. If you set it to 5V, you must make sure your 5V supply is stable. Otherwise, your readings will be wrong. Most 5V supplies are not very stable. E.g. USB is rated from 4.7-5.2 volts
      I once made a video where you can use a trick to adjust for this error using the internal reference.

    • @youpattube1
      @youpattube1 2 роки тому +1

      @@AndreasSpiess Thanks again for the reply. I didn't realize that about the tiny. I did do a comparison of the Internal vs Default measurement of 1v using the Nano. Only 1% difference.

  • @dipakbhagat8667
    @dipakbhagat8667 8 років тому +1

    Hi, I am DIpak. Recently i brought digispark attiny85 and 0.96" OLED ssd1306. when I interfaced with arduino uno were it was quite easy. BUT i found very difficulty while interfacing with digipspark attiny85 module. Please help me with providing me the code and library.

    • @AndreasSpiess
      @AndreasSpiess  8 років тому

      Please look in the description of the video. I think there is the library

    • @pauldusa
      @pauldusa 7 років тому

      I completed digispark attiny85 / Oled,, working in 10 min, so it Does work,, Easy. only needed
      #include
      #include

  • @alvarobravok
    @alvarobravok 5 років тому +2

    Dumber me, tried to do it with Digispark! Fail... USB interface interferes... need to get the ATTiny alone!!

    • @kitecattestecke2303
      @kitecattestecke2303 4 роки тому

      ? Sure ? It should work the USB interface is done in software and can be used with some pins on them so??? In what way does it interfere?

    • @wakscientist7410
      @wakscientist7410 4 роки тому

      @@kitecattestecke2303 The digispark uses one of its pins dedicated to usb. Can cause problems in programming if hooked up to a circuit and problems in operation. Think of the digispark as having only three usable pins instead of 4. I learned the hard way, lol.

  • @bennydmduiken
    @bennydmduiken 4 роки тому

    Can somebody give me a type number of the MOSFET? I suppose P-channel or N-channel will work. I want to experiment with this by replacing the switch with a LF-generator. I have a pos or a neg puls of one volt. So the MOSFET needs to conduct FULLY with a VGS of max=1V. I have no clue which FET to use. Please help

    • @AndreasSpiess
      @AndreasSpiess  4 роки тому

      Here you see that I used a 3055 n-channel FET (ua-cam.com/video/mKPKQm0uPBQ/v-deo.html). It will not be easy to find a MOSFET with 1 volt Vgs, but Mouser etc. have selection tools on their homepage.

  • @scottmitten2248
    @scottmitten2248 6 років тому

    Having a little issue ...
    have been using the library from GitHub to successfully print some info on screen - a float.
    Now trying 'printBigNumber' and getting an "Undefined Reference" error when compiling - specifically mentioning the printBigNumber function.
    Already found an apparent error in the example sketch: dtostrf(empty, 1, 2, tmp);
    ("1" should be total chars, "2" is digits after decimal. "1" should be larger)
    for my usage, replaced with: dtostrf(tempC,5,1,tmp); // Convert tempC to Array of Chars - 5 char total, 1 after decimal
    -this line seems to compile fine.
    next line is where the error is flagged:
    OzOled.printBigNumber(tmp, 0, 0, 5); // Print Large Font up to 5 Chars
    Any suggestions?? Thanks

    • @AndreasSpiess
      @AndreasSpiess  6 років тому

      You mentioned that it was working. So maybe you go back to the working example and change one after the other to find which change creates the problem. That is how I usually do it.

    • @scottmitten2248
      @scottmitten2248 6 років тому

      @@AndreasSpiess printBigNumber is the only part that has the error. :(
      The rest of the Library seems to work fine - at least all the functions I've used.
      I only get the error if I try to use the function. Just commenting out the one function call is enough to make the sketch compile properly.
      Hope that clarifies, and I appreciate the response. :D

  • @vinceherried497
    @vinceherried497 8 років тому

    I am building this project and I wonder why the power mosfet is does not have the source connected to GND, and the 1 ohm resisters on the drain it would see this would give a slightly higher voltage on the gate, ensuring it gets turned on.

    • @AndreasSpiess
      @AndreasSpiess  8 років тому

      I did not pay a lot of attention to the details. So, go ahead if you can improve it! "The better is always the enemy of the good" ;.)
      Usually, I use logic level FETs that they are switched on as much as possible. I do not remember, but if I measure directly at the battery, the voltage drop should not be a problem because it is after the measuring. But I du not remember exactly how I did it.

    • @bennydmduiken
      @bennydmduiken 4 роки тому

      @@AndreasSpiess Hello Andreas. Great stuff. Which Power Mosfet would you recommend?

  • @KennethTanFotografie
    @KennethTanFotografie 8 років тому

    Andreas, could you please explain why the two 10K dividers for measuring the voltage?
    I assume you need the voltage of the battery with load disconnected and the voltage with load?

    • @AndreasSpiess
      @AndreasSpiess  8 років тому

      If I remember right I use the internal reference voltage of 1.1 volt for the ADC. This is why I divide the battery voltage by 2. this leaves a bit of safety margin.

    • @KennethTanFotografie
      @KennethTanFotografie 8 років тому

      +Andreas Spiess Clear! Thank you

  • @melisawhitt8360
    @melisawhitt8360 7 років тому

    OK i will do that..... have you ever made a video for using an attiny85 with an I2C LCD i would like to see that if you ever have

  • @melisawhitt8360
    @melisawhitt8360 7 років тому

    Hello I have several.... ADS1115... I2c AD converters is there a way to use these library's with this AD converter ?

    • @AndreasSpiess
      @AndreasSpiess  7 років тому

      Yes, I think so. I even made a video about these ADCs

  • @JerryEricsson
    @JerryEricsson 8 років тому

    I like it, I like it! I have one of those "universal" battery checker that I got from Cina for a few bucks. Burnt one out trying to check the charge on an 18650, not really sure why but I replaced it with another just like the first. Now I just avoid the Lithium batteries and use it for the "regular" rechargables. This looks like a grand idea! I have a few Digispark TTTiny 85's I may try to program one of these for this mission, plenty of aa and aaa battery cases litter my supply cabnite so I am good to go for this one. Maybe! Still don't have my OLED's but they are on their way from China as I type, have been for a couple of weeks, so the slow boat may well be in sight of Seattle,,

  • @atariandre5014
    @atariandre5014 6 років тому

    Very nice, I am trying to get your TinyOzOLED library to run, but it seems I also need the original OzOLED library as your examples are including that (Include OzOLED.H).
    I searched but there are various OzOled libraries on Github, which one was the original ?

    • @AndreasSpiess
      @AndreasSpiess  6 років тому +1

      I do not think you need the OzOLED library if you the TinyOzOLED library of my GitHub. Only the example files were misleading. This is why I deleted them. The battery tester sketch should compile with the TinyOzOLED library installed

    • @atariandre5014
      @atariandre5014 6 років тому

      Andreas , thank you for your quick reply, I will test it ASAP.

    • @atariandre5014
      @atariandre5014 6 років тому

      Got it working with some tweaking !
      Can print int variables to the screen using printNumber But now I want to use printBigNumber but I don’t really understand how it works....needs a bit more puzzling :)

  • @BillBaran
    @BillBaran 3 місяці тому

    What are those interface cards attached to the proto boards?

    • @AndreasSpiess
      @AndreasSpiess  3 місяці тому +1

      I assume you mean the power supply cards? They supply either 5V or 3.3V to the power rails of the boards

  • @BeetleJuice1980
    @BeetleJuice1980 6 років тому

    is it possible to measure the internal resistance cause it seems its all there in the hardware , it needs only some math in the code and it can display internal resistance of the battery too. you can make this project with an ads1115 or an ina219 and have amazing accuracy and display internal resistance ,load voltage and float voltage (so a super battery tester) !

    • @AndreasSpiess
      @AndreasSpiess  6 років тому

      Should be possible. But so far I was never interested in this value.

  • @gpTeacher
    @gpTeacher 3 роки тому

    Hi Andreas. Thank you for the tutorial. How did you figure out C8 and A1 for the orientation commands. Where did you look? I couldn't find them in the .h or .cpp files. Any insights are welcome. Thanks, Gord

    • @AndreasSpiess
      @AndreasSpiess  3 роки тому

      I do not know what you refer to. This is a very old video.

    • @gpTeacher
      @gpTeacher 3 роки тому

      @@AndreasSpiess thanks for responding Andreas. I went to the datasheet and found the hex values. Best wishes.

  • @trhtpc
    @trhtpc 6 років тому

    I think that the most environment friendly is to use rechargeables?

  • @melisawhitt8360
    @melisawhitt8360 7 років тому

    this is an interesting project I have all the parts but i cant see your schematic ? and is there a function to print Text for this library

    • @AndreasSpiess
      @AndreasSpiess  7 років тому

      1. I do not have a schematic. Maybe you ask Vince Herried which wrote a comment below. He built (and I think, also enhanced) my design
      2. If you look at the examples of the library, you see a "Hello World" example.

  • @jesuschoyley7088
    @jesuschoyley7088 Рік тому

    Please Can anyone share OzOLED library?
    The link in the description no longer works.

  • @codebeat4192
    @codebeat4192 7 років тому

    To avoid OLED display flicker and unnecessary processor stress, remove this line: OzOled.clearDisplay(); it works fine without it.

  • @MilanKarakas
    @MilanKarakas 8 років тому

    Good to know that there is hope in the form of library for Attiny. Great video! One thing I found problematic though is your analog measurement calculation, which seems that propagate through whole work:
    int in0 = analogRead(A0);
    float val0 = in0 * 5.0 / 1023.0;
    Why you divide with 1023? When 10 bit ADC has 1024 steps (0-1023). You should to divide referent voltage with 1024 in order to get proper result. Does this makes sense to you? Thanks.

    • @MilanKarakas
      @MilanKarakas 8 років тому

      It is also addressed here: www.electro-tech-online.com/threads/why-adc-1024-is-correct-and-adc-1023-is-just-plain-wrong.132570/

    • @MilanKarakas
      @MilanKarakas 8 років тому

      To get proper scaling, one should use "pre-math" to scale up reference voltage: 5/1024+5=5.004882813, which may give result on ADC value of 1023 = 4.999995232, which will be rounded up to 5 decimals, and for those who want rather to see number slightly over 5, probably should round reference voltage number to 5.00489, in which case ((5.00489/1024)*1023) = 5.000002412 (where 1023 is now ADC reading result).

    • @MilanKarakas
      @MilanKarakas 8 років тому

      To clarify formula above: vref/1024+vref as a value that should be included in the arduino math, or:
      float vref=5.0; //be sure that VCC is really 5V, it can vary!
      float V=((vref/1024+vref)/1024)*analogRead(A0);
      //in example above, arduino nano is used and A0 as analog input

    • @AndreasSpiess
      @AndreasSpiess  8 років тому

      You are right.

    • @MilanKarakas
      @MilanKarakas 8 років тому

      Thanks.

  • @cadexperteblender7551
    @cadexperteblender7551 4 роки тому

    Nice project! I just want to build it by myself but I dont know where to buy the FET. Please help me.

  • @alexandrospetkos
    @alexandrospetkos 8 років тому +1

    Thank you so much for you help keep going !!!

  • @wes8732
    @wes8732 Рік тому

    Love the video & content ! Um, how is anyone building this / these without schematic ? Just curious...

    • @AndreasSpiess
      @AndreasSpiess  Рік тому

      It is a very simple build and you see the diagram in the video. But you are right, I could have added it to my repository.

  • @budosfasz
    @budosfasz Рік тому

    Hello, 5:23 why the Attiny85 nr 1 pinout /reset/ is on positive? On the circuit diagram there is nothing on nr 1 pinout /reset/.

    • @AndreasSpiess
      @AndreasSpiess  Рік тому

      Best practice is to pull the reset line to "high". But usually, it also works without it...

    • @budosfasz
      @budosfasz Рік тому

      @@AndreasSpiess first of all thank you for your response. I copy to your project, but it not working well. I used your code without any change. I used exactly the same components. I don't understand why it is not working. Here is a video how is working : ua-cam.com/video/xh4ZwNRIJFA/v-deo.html

    • @AndreasSpiess
      @AndreasSpiess  Рік тому

      ​@@budosfasz It seems that the voltage is not correct. So you have to fix this one first by measuring the voltage at pin 3 of the ATtiny with a multimeter. You have to adjust the FACTOR if the value of the multimeter and the display is not the same.
      If I remember right, the ATTiny cannot measure voltages above 1.1V (internal reference)

    • @oqibidipo
      @oqibidipo Рік тому

      @@AndreasSpiess There is also 2.56 V internal reference with or without a bypass capacitor connected to AREF. It was not supported in Arduino when the video was made.

    • @budosfasz
      @budosfasz Рік тому

      @@AndreasSpiess I measured the pin 3 but all the time got different voltages: ua-cam.com/video/Ja-escUZzXs/v-deo.html

  • @df9999999999
    @df9999999999 7 років тому

    Any chance you could post the schematic with the sketch? Nice project! I noticed the current sense ADC line is connected directly between the MOSFET and the two 1 ohm series resistors. Doesn't this drive the ADC above the internal 1.1 volt reference when connected to a 1.5 volt cell, which would seem to be a bad thing, even if the current reading is not displayed? Is there a reason the display clears every cycle? Removing the clear command simply allows the display to update without the display blink on every read.

    • @AndreasSpiess
      @AndreasSpiess  7 років тому

      1. The sketch was already on my Github. I now added the Eagle files and a pdf.
      2. The current sense is a 1 Ohm resistor. And the maximum allowed voltage on any Attiny pin is VCC+.5V (datasheet). So we are save till 5A (U=R x I). The voltage measurement is divided by two with 2 resistors.
      3. There was a reason for this blinking, but since this is long ago, I do not remember. But maybe you can omit it. I just did not have the time...

    • @df9999999999
      @df9999999999 7 років тому

      Thanks for the response!
      Regarding point #2, if only a single one ohm (or 2 ohm) resistor is used, the voltage dropped across the sense resistor is the full 1.5 volts of the battery. Anything over 1.1 volts will be read as 1023, so the sense values retrieved will not be useful over the full battery voltage range. Two 1-ohm resistors with the ADC sense line between them will drop the voltage to a usable range. The schematic in the video shows two-1 ohm current sense resistors, but the ADC lead is not between them, which I believe is in error.

    • @AndreasSpiess
      @AndreasSpiess  7 років тому +1

      I watched now the video again. There, I say, that the maximum current is about 500 mA which would then be 1 volt on 2 ohm. Please consider also the internal resistor of the battery. You are right, with a powerful new battery the value could go over 1.1v. But what would this result say? The battery is new. And this is the purpose of this device.
      You can put the lead between these resistors if you want. This extends the range on the "good battery" side and reduces it a little on the "bad battery" side.
      You are right if you expect a proper current measuring tool. Then, this "crappy" design is for sure not good enough. But to distinguish between good and bad batteries, it helped me.

    • @df9999999999
      @df9999999999 7 років тому +2

      Andreas Spiess In your sketch, it doesn't matter if the battery voltage goes above 1.1 as far as current sensing is concerned. As you observed, it is safe to go up to 5 volts. Also. you are reading the current but not displaying it or using it in any calculations, so it is fine if the range is reduced. I wanted to display current under load as well, so I put the ADC line between the two - 1ohm resistors and changed the calculation slightly to get the correct current over the full battery range, even > 1.1 volt, which is not unusual for a good battery.
      I also changed the MOSFET so the source is connected to ground to minimize the resistance introduced by the MOSFET. I think this was in another comment as well.
      You can see a picture and code changes I made at projectmf.homelinux.com/Arduino/BatteryTesterAttiny_DON
      Thanks for the great project! I had much fun experimenting with it.

    • @AndreasSpiess
      @AndreasSpiess  7 років тому +1

      :-)

  • @Tasty_sand
    @Tasty_sand 4 роки тому

    Now I know what chip to use for small slave devices.

  • @Friendroid
    @Friendroid 8 років тому

    I would like to measure the battery voltage and sound a buzzer with pwm under a certain threshold, is it possible? Attiny85, buzzer and 1S Li-po battery only. The battery would be connect to VCC and the buzzer would sound at 2kHz if under 3.7Volt. Not sure if the battery needs to be connected to Analog pin or if I can measure the attiny85 working voltage, hence my question.

    • @AndreasSpiess
      @AndreasSpiess  8 років тому

      ATTINY85 runs down to 2.7 Volts, so this should be possible. You can connect the battery to one of the analog pins.
      Usually you do not need PWM for buzzers because they are not loudspeakers. If you connect them to 5V they buzz. You have to try their minimum operation voltage.

    • @Friendroid
      @Friendroid 8 років тому

      +Andreas Spiess Thank you very much for the quick reply. The buzzer I will is not Active version, it needs a modulated signal like square or saw wave. I believe the Arduino has a Tone library that can be used.

    • @AndreasSpiess
      @AndreasSpiess  8 років тому

      Then I would call it a "loudspeaker". You can use the tone library for these.

    • @Friendroid
      @Friendroid 8 років тому

      +Andreas Spiess Thank you for the correcting the terminology

    • @MilanKarakas
      @MilanKarakas 8 років тому

      Yet, everywhere on the eBay (mostly China) the call it passive buzzer, and active buzzer. Still confusing, but that is how they name their products.

  • @Skropppy
    @Skropppy 6 років тому

    Nice video does this work for 3.7V Lithium-Ion Batteries?

    • @AndreasSpiess
      @AndreasSpiess  6 років тому

      Not very good. LiPo batteries are quite different.

    • @Skropppy
      @Skropppy 6 років тому

      ah, ok... because I'm looking for a cheap solution to monitor Lithium-Ion Batteries, that they don't discharge too much because of theire self discharge rate.
      For example: a red LED starts glowing when the 3.7V batterie goes under 3.3V.

  • @zyghom
    @zyghom 2 роки тому

    7 years ago it was a different man ;-)

  • @CanadianWinters
    @CanadianWinters 8 років тому

    Very nice! Is it possible to display double digit numbers to test a 12v battery for example?

    • @AndreasSpiess
      @AndreasSpiess  8 років тому

      +Jacopo Rodigari Should not be a problem. Just adjust the voltage divider (R2/R3) that it supports 12V.
      One thing, however is the current. I use a quite small load for the small batteries. I you want to test bigger batteries I assume you need also a bigger current as a load. This would need then a bigger resistor (R1/R4) and a stronger FET (U$2) at 5:35

    • @CanadianWinters
      @CanadianWinters 8 років тому

      +Andreas Spiess thank you. I was not clear with my question. I was,curious if the software could be modified for larger voltage measurements. I run some tests and it's possible but if the voltage from the divider is bigger than the internal vreference it doesn't work, the vreference needs to match the external supply. Your project opens up a lot of different uses for these little attinys combined with the oleds screens!!

    • @AndreasSpiess
      @AndreasSpiess  8 років тому

      +Jacopo Rodigari This is the purpose of voltage dividors, to reduce voltage to an acceptable level. If you look into the data sheet of the Attinys you see, that you easily can destroy the chip by applying a too voltage higher to VCC to a pin!
      If you browse through my videos you see also other uses of the ATtinys (e.G. an "home made" I2C chip. I like them very much.

  • @Lunte10
    @Lunte10 4 роки тому

    Please ,what is the Load at 0:49 2 Ohm ? , sorry I can not hear it acoustically what he says

  • @titokrissel4474
    @titokrissel4474 2 роки тому

    Hi try using your library with an ATtiny85 with a 128x32 OLED. I replaced the parameters of your library and I saved the Sketch with 1MHz internal but it didn't work. Do you have any suggestion for me? Thank you and cordial greeting from Argentina.
    SPANISH: Hola intente usar tu librería con un ATtiny85 con un OLED 128x32. remplace los parametros de tu librería y grabé el Sketch con 1MHz interno pero no me anduvo. tienes alguna sugerencia para mi. Gracias y cordial saludo desde Argentina.

    • @AndreasSpiess
      @AndreasSpiess  2 роки тому

      This is a very old video and I do no more remember. Maybe you find another library which supports your OLED? Or you first try it exactly as I did and if it works, start to change to find out where the problem is.

    • @titokrissel4474
      @titokrissel4474 2 роки тому

      @@AndreasSpiess OK thank you

  • @defavltt
    @defavltt 4 роки тому

    I really like this library you made! Is there a way I can rotate the screen 90 degrees so I can read the text in vertical orientation of the display?

    • @AndreasSpiess
      @AndreasSpiess  4 роки тому +1

      I do not think it is easy. Maybe you try. And please do not contact me on other channels for the same question.

    • @defavltt
      @defavltt 4 роки тому +1

      @@AndreasSpiessThank you for the reply, yesterday I just sent you a mail for the same question for good reason, I didn't know where you would reply. And yeah I came to the same realization.

  • @BertHeideveld
    @BertHeideveld 6 років тому

    Hello Andreas Spiess.
    I have used this sketch a few times.
    That went fine.
    But now I get the message that the sketch is too big (6,804 Bytes).
    The space that is seen in the Atiny85 by ide 1,8, xx would be 6,012 bytes.
    Unfortunately, I can not use the sketch now.
    Has the ozoled.h changed?
    Do you have an experience with this.
    Greetings Bert.

    • @AndreasSpiess
      @AndreasSpiess  6 років тому

      I do not know. I did not use this library for quite a long time so I do not know.

    • @BertHeideveld
      @BertHeideveld 6 років тому

      Thank You.

    • @BertHeideveld
      @BertHeideveld 6 років тому

      Can you tell me how big your sketch is now?
      Then I can compare.

  • @hussain55019
    @hussain55019 5 років тому

    ATiny has internal clock or does it need an external one?

  • @gab0rb0gnar
    @gab0rb0gnar 8 років тому

    hey, it's not clear to me but how do you power the final 'device' ?

    • @AndreasSpiess
      @AndreasSpiess  8 років тому

      +Gabor Bognar With my bench power supply. but it could also 2 AAA batteries. I do not use it every day, so this solution is ok for me.

    • @gab0rb0gnar
      @gab0rb0gnar 8 років тому

      +Andreas Spiess Thanks, it makes sense. My only problem is to get the small OLED :)

    • @AndreasSpiess
      @AndreasSpiess  8 років тому +1

      +Gabor Bognar This is very easy:
      www.aliexpress.com/item/New-0-96-I2C-IIC-Serial-128X64-OLED-LCD-LED-Display-Module-For-Arduino-55785/32357566914.html?spm=2114.30010308.3.8.5t0ANd&ws_ab_test=searchweb201556_2,searchweb201644_2_505_506_503_504_301_502_10001_10002_10016_10005_10006_10003_10004,searchweb201560_8,searchweb1451318400_-1,searchweb1451318411_6449&btsid=e3b606b6-02e7-4e45-b5dc-10b8ce9bcab0

  • @ajayvashisht9708
    @ajayvashisht9708 3 роки тому

    hi there can u help me figure out how to measure voltage divider output with attiny85! help pls

    • @AndreasSpiess
      @AndreasSpiess  3 роки тому

      I am a UA-camr, not a consultant. But you have Google to answer your question.

    • @ajayvashisht9708
      @ajayvashisht9708 3 роки тому

      @@AndreasSpiess I have developed a circuit using Attiny85 and I am not able to get voltage value on using voltage divider on Port Pin 2 and I am not able to figure out what is the issue!

    • @AndreasSpiess
      @AndreasSpiess  3 роки тому

      RTFM? Do you use the right pin number?

    • @ajayvashisht9708
      @ajayvashisht9708 3 роки тому

      @@AndreasSpiess I didn't understand what "rtfm" is? And I have read all the required documents regarding attiny85 and I have used the right pin for reading voltage from voltage divider and I have used usb development board of attiny85 provided by digispark and I have also used the right library to program it and when I am using the same circuit using Arduino Uno it works perfectly. I would really appreciate your guidance regarding this issue !
      Thank you!

  • @TheUnofficialMaker
    @TheUnofficialMaker 6 років тому

    You should add a result code: OK, LP or BAD after each test

    • @AndreasSpiess
      @AndreasSpiess  6 років тому

      This is an old project. But if you want, you are free to add these lines of code in your device.

  • @alvaroyanez7393
    @alvaroyanez7393 7 років тому

    Hi! this is a really nice proyect!
    I have tried to implement it with a 128x32 oled screen, but so far it has been impossible!
    Might you help me ?

    • @AndreasSpiess
      @AndreasSpiess  7 років тому

      What exactly is your problem? Did you try the OLED itself with the example files? Does it work?

    • @pplg-yt
      @pplg-yt 4 роки тому

      @@AndreasSpiess I've got the same problem... The thing is that it seems to vertically "compress" the string of characters that I print. I don't know exactly what the issue is but, although it prints, it's hard to read because I think that it removes some horizontal rows and stick the rest together. It's not the display, I have already tested it. Could you please help me? Thank you!

    • @pplg-yt
      @pplg-yt 4 роки тому

      @@AndreasSpiess Btw, I have tried the exact same code with a 128x64 OLED display and it works fine. Is it possible that the print function does work properly only with the 128x64 and not with the 128x32? Thank you in advance.

  • @BertHeideveld
    @BertHeideveld 7 років тому

    Hey .
    Can the numbers and characters also be made smaller.
    Via the ozoled Lib. commands.
    I try but I can not.
    I am a 71 year old beginner.
    Please your comment.
    Greetings Bert (Dutch accent) :-)

    • @AndreasSpiess
      @AndreasSpiess  7 років тому

      You should be able to replace the command printBigNumber with printNumber. Maybe it works...

    • @BertHeideveld
      @BertHeideveld 7 років тому

      The print option number is very small characters.
      The printBigNumber is very large.
      I would like half smaller.
      Is that possible ?
      Here is a sketch of me.
      Digi Park Tiny85> Oled.
      Based on your Batt. tester
      Thanks.
      /* Auteur B.Heideveld 09-03-2017
      Digisparktiny85 Temperatuur on Oled.
      Lm35Dz or Lm36Dz sensor op P4
      LmxxDz needs stabele Vcc or Reference DC
      Oled SDA op P0
      Oled SCL op P1
      Thanks to Andreas Spies :-)
      */
      #include
      #include
      // ATtiny P0 = SDA ATtiny Pin 6 = (D1) to LED2
      // ATtiny P1 = SCL ATtiny Pin 8 = VCC (2.7-5.5V)
      #define TEMPIN A2 // TEMPIN OP Pin 2 = P4
      float temp ;
      void setup() {
      analogReference(INTERNAL); // use precise internal reference
      OzOled.init(); //initialze OLED display
      OzOled.clearDisplay(); //clear the screen .
      OzOled.setNormalDisplay(); //Set display to Normal mode
      OzOled.sendCommand(0xA1); //Set Orientation
      OzOled.sendCommand(0xC8); // to normal
      }
      void loop() {
      temp = analogRead(TEMPIN);
      temp = temp / 34.5;
      displayOLED();
      delay(10000);
      OzOled.clearDisplay();
      }
      void displayOLED() {
      char tmp[10];
      dtostrf(temp, 2, 1, tmp);
      OzOled.printBigNumber(tmp, 1, 0, 4);
      OzOled.printString( 0, 5, 6);
      OzOled.printString("Gr/C");
      }

    • @AndreasSpiess
      @AndreasSpiess  7 років тому

      This library only has two fonts. Big and small

    • @BertHeideveld
      @BertHeideveld 7 років тому

      To small ha ha Thanks.

  • @mikesterling3949
    @mikesterling3949 8 місяців тому

    Does TinyOzOled work with ATtiny84 ?

    • @AndreasSpiess
      @AndreasSpiess  8 місяців тому

      I do not know. Maybe you just try?

  • @chicagomike6666
    @chicagomike6666 4 роки тому +1

    I don't mind a short ad-but multiple adds for like 10 min means I never stayed around to see your video...🙄

    • @AndreasSpiess
      @AndreasSpiess  4 роки тому

      You only should get ads at the beginning and at the end of my videos ( if you stay). And sometimes one in the middle if the video is longer than 20 minutes

  • @GnuReligion
    @GnuReligion 6 років тому

    You can fuse out the reset, and keep the Micronucleus bootloader ... giving you 4 clean I/O pins in addition to those used for V-USB. I know this is an old vid, but just thought you might like to check out the LittleWire approach to the t85: littlewire.github.io/

    • @AndreasSpiess
      @AndreasSpiess  6 років тому

      Thanks for your link. I know about the fusing, but it was too complicated for me. So I only tried it without using it in my projects.

    • @GnuReligion
      @GnuReligion 6 років тому

      Yes, the official documents are inscrutable. Thankfully, there is this site: www.engbedded.com/fusecalc/
      The fuses shipped with one I have at hand right now are: (E:FE, H:DD, L:E1). You select attiny85 from the pull-down, put your current fuse items in at the bottom. When you click the disable reset box, look at the bottom of the page, it it will actually give you the NEW avrdude parameters. So disabling reset becomes: avrdude -p t85 -c [YOURISP] -U lfuse:w:0xe1:m -U hfuse:w:0x5d:m -U efuse:w:0xfe:m ... one bit difference.
      This will make your t85 ISP work better, because you will no longer need to manually connect the reset to ground on your target device.

  • @coolweirdgreat
    @coolweirdgreat 9 років тому

    how did you modify the library? I have tried replacing the include files in the hello world code but cannot get it to work

    • @AndreasSpiess
      @AndreasSpiess  9 років тому

      +coolweirdgreat Can you be a bit more specific about what does not work? To change a library I change the text with a text editor. Then, I make shure, that the IDE selects the changed library, because it looks at different places for libraries. And sometimes, it does not chose the library you intend to use, even if it has the same name.

    • @coolweirdgreat
      @coolweirdgreat 9 років тому

      +Andreas Spiess I have installed the two libraries TinyOzOLED and TinyWireM. I hooked up my OLED as shown. I was able to compile and upload this simple example code, but the screen remains black. Im not sure what the problem is. The screen still works with the ArduinoUno Just not the attiny.
      #include
      #include
      // ATtiny Pin 5 = SDA ATtiny pin 4 = GND
      // ATtiny Pin 7 = SCL ATtiny Pin 8 = VCC (2.7-5.5V)
      void setup() {
      OzOled.init(); //initialze OLED display
      OzOled.clearDisplay(); //clear the screen and set start position to top left corner
      OzOled.setNormalDisplay(); //Set display to Normal mode
      OzOled.sendCommand(0xA1); // set Orientation
      OzOled.sendCommand(0xC8);
      }
      void loop() {
      displayOLED();
      delay(500);
      OzOled.clearDisplay();
      }
      void displayOLED() {
      OzOled.setCursorXY(30, 60);
      OzOled.printString("Hello World!"); //Print the String
      }

    • @AndreasSpiess
      @AndreasSpiess  9 років тому

      +coolweirdgreat I just checked on my Attiny85 and it works with the library from my github and the tinywire from Adafruit. Just the text dos not start left. Did you set the fuses (in Arduino IDE: burn the bootloader in tools menu. If you did this, I would start with a blink program on the Attiny to test whether a simple sketch works on it. Otherwise come back and we will see ;)?

    • @coolweirdgreat
      @coolweirdgreat 9 років тому

      +Andreas Spiess Yes I have set the fuses and burned the boot loader Attiny 85 1Mhz internal clock. I runs The blink sketch properly. I am unsure what the problem is. Maybe it is the programmer I am using. This is it www.sparkfun.com/products/11801 Thanks for all your help it is greatly appreciated.

    • @AndreasSpiess
      @AndreasSpiess  9 років тому

      +coolweirdgreat So the only difference I see is that I use 8MHz internal clock and no divide (Low Fuse E2 and high Fuse DF). Can you try? You can check with AVRDUDESS.
      I cannot believe it is the programmer if you are able to transfer sucessfully other sketches to your Attiny. It should not distinguish between one or the other sketch...
      And then, the usual suspect: Just check again wiring of SDA/SCL. After that, I am also at the end of my knowledge!

  • @The0ohm
    @The0ohm 8 років тому

    just a friend to pick brain in a jam. maybe showoff board in 1 of your how to's and drawing of your tester for wife.

  • @weerobot
    @weerobot 5 років тому

    Awesome...

  • @Graham1904
    @Graham1904 8 років тому

    You keep mentioning that a short time is required for the "on load measurement" but you never mention what this is and even your scope display is not easy to read this.

    • @AndreasSpiess
      @AndreasSpiess  8 років тому

      I just looked into my sketch. It is not defined. I switch the FET on, measure the voltage till it is stabe, measure then 10 times the current and build an average. Then, I switch the FET off. This takes a few miliseconds. But it is not critical.

    • @Graham1904
      @Graham1904 8 років тому

      Ok thanks for the prompt reply...keep up the good work :)

  • @youpattube1
    @youpattube1 2 роки тому

    I read all the comments and no one ask this question, so it must be so obvious that no one has a problem with it. But I do. And I have tried many iterations of characters, strings, arrays, etc., and can't get it to BigPrint text. OzOled.printBigNumber works fine for numbers converted to strings, but how do I append a big 'V' for voltage to a bigNumber being displayed ?

    • @AndreasSpiess
      @AndreasSpiess  2 роки тому

      The library has a "Hello World" example. So it should be possible to print strings. You have to create a String before you display it. Not easy, but Google is your friend.

    • @youpattube1
      @youpattube1 2 роки тому

      @@AndreasSpiess hmmm. Ok.thanks. I'll noodle on it.