License

CC-BY-SA 3.0

Tags
Recommend Projects

ATtiny85 TinyLoad

1 year ago 3904
  • Description
  • Documents
  • BOM
  • Attachments
  • Members
  • Comments

Description

Overview

TinyLoad is a simple electronic constant current dummy load. The ATtiny measures voltage, current and temperature of the heat sink, calculates power, energy and battery capacity, controls the fan and displays all relevant data on the OLED. The button is used to switch between power/resistance and energy/capacity display.

TinyLoad_pic1.jpg

Hardware

The electronic load control circuit, which essentially consists of a potentiometer, an operational amplifier, a MOSFET and a shunt resistor, ensures that the same current flows regardless of the voltage applied.

TinyLoad_pic4.png

For this purpose, a 100 milliohms shunt consisting of three 300 milliohms resistors in parallel for proper heat dissipation is located in the load circuit, via which the current is measured. The LMV358 rail-to-rail OpAmp compares this with the target value, which is specified via a 10-turn 10k potentiometer and a 100k resistor and accordingly controls the gate of an IRL540N logic level power MOSFET, which in turn adjusts the current through its internal resistance set in this way. The current measured at the shunt is also amplified by a second OpAmp and measured by the ADC of the ATtiny. The voltage is measured using a voltage divider. The temperature of the MOSFET is measured by a 10k 3950B NTC thermistor. If necessary, the fan is switched on via a MOSFET.

TinyLoad_pic3.jpg

Software

Measurements

For the most accurate measurement possible with maximum measurement resolution, both the 5V supply voltage and the two internal reference voltages in connection with the ADC of the ATtiny are used. First, the supply voltage and the 2.56V reference are measured using the 1.1V reference and corresponding calibration factors are calculated. For each pending measurement, it is first checked which of the three voltage references (5V, 2.56V or 1.1V) is most suitable. This is then used for the measurement via the ADC. For all ADC measurements, the ATtiny is set to sleep mode in order to avoid noise that is generated by the MCU (ADC noise canceler). To further increase the measurement resolution, 64 measurements are carried out in succession (oversampling) and the measured values are added up. The averaging is only carried out at the end of the further calculations in order not to lose any measurement resolution. The measurement accuracy depends essentially on the accuracy of the internal 1.1V reference. This can be calibrated manually if necessary.

Accuracy of Energy and Capacity Determination

The internal oscillator of the ATtiny is used to determine energy and electric charge (capacity). The accuracy of the internal oscillator is +/-10% with the factory calibration. This can be improved to +/-2% or better by manual calibration.

I²C OLED Implementation

The I²C protocol implementation is based on a crude bitbanging method. It was specifically designed for the limited resources of ATtiny10 and ATtiny13, but it works with some other AVRs (including the ATtiny25/45/85) as well. The functions for the OLED are adapted to the SSD1306 OLED module, but they can easily be modified to be used for other modules. In order to save resources, only the basic functionalities which are needed for this application are implemented. For a detailed information on the working principle of the I²C OLED implementation visit TinyOLEDdemo.

Compiling and Uploading

If using the Arduino IDE

  • Make sure you have installed ATtinyCore.
  • Go to Tools -> Board -> ATtinyCore and select ATtiny25/45/85 (No bootloader).
  • Go to Tools and choose the following board options:
    • Chip: ATtiny45 or 85 (depending on your chip)
    • Clock: 1 MHz (internal)
    • B.O.D.Level: B.O.D. enabled (2.7V)
    • Leave the rest at the default settings
  • Connect your programmer to your PC and to the ICSP header on the board.
  • Go to Tools -> Programmer and select your ISP programmer (e.g. USBasp).
  • Go to Tools -> Burn Bootloader to burn the fuses.
  • Open TinyLoad sketch and click Upload.

If using the precompiled hex-file

  • Make sure you have installed avrdude.
  • Connect your programmer to your PC and to the ATtiny.
  • Open a terminal.
  • Navigate to the folder with the hex-file.
  • Execute the following command (if necessary replace "t85" with your chip and "usbasp" with the programmer you use):
    avrdude -c usbasp -p t85 -U lfuse:w:0x62:m -U hfuse:w:0xd5:m -U efuse:w:0xff:m -U flash:w:tinyload.hex

If using the makefile (Linux/Mac)

  • Make sure you have installed avr-gcc toolchain and avrdude.
  • Connect your programmer to your PC and to the ICSP header of the device.
  • Open the makefile and change the chip if you are not using ATtiny85 and the programmer if you are not using usbasp.
  • Open a terminal.
  • Navigate to the folder with the makefile and the Arduino sketch.
  • Run "make install" to compile, burn the fuses and upload the firmware.

Operating Instructions

Usage

  1. Turn the potentiometer full counter-clockwise.
  2. Connect the device via the Micro-USB connector to a 5V power supply.
  3. Connect the test power supply to the block terminal. Pay attention to the correct polarity!
  4. Turn the potentiometer clockwise to choose the desired load current.

Calibration

The ADC and the internal reference voltages of the ATtiny do their best to make the tinyLoad a pretty accurate tool, but it might need a little calibration. How to calibrate:

  • Set ULCAL and ILCAL to "1" in the sketch, compile and upload.
  • Choose a stable input voltage of around 5V and turn the poti until the display shows a current of around 0.7A. Measure the voltage and the current with a trusty multimeter or a good lab bench power supply.
  • Calculate the calibration factors as follows:
    • ULCAL = voltage measured with multimeter / voltage shown on OLED.
    • ILCAL = current measured with multimeter / current shown on OLED.
  • Set the ULCAL and ILCAL value in the sketch, compile and upload again.

Precautions

  • Use a good heatsink with a 5V fan for the MOSFET !
  • Be careful with high power loads ! This device is called "tinyLoad" for a reason !
  • Always turn the POTI full counter-clockwise before connecting the load !
  • Due to the input offset voltage of the OpAmp the minimum load current is 17mA. You can use a better OpAmp like the OPA2330 or OPA2333 if you like.
  • The maximum load current is 4.5A, however for small voltages it might be less.
  • Do not exceed the maximum voltage of 26V !

References, Links and Notes

  1. ATtiny25/45/85 Datasheet
  2. LMV358 Datasheet
  3. IRL540N Datasheet

TinyLoad_pic2.jpg

License

license.png

This work is licensed under Creative Commons Attribution-ShareAlike 3.0 Unported License. (http://creativecommons.org/licenses/by-sa/3.0/)

Documents

Tiny Load

TinyLoad_v1.0

BOM

ID Name Designator Footprint Quantity
1 1N4148W D3 DIODE-SOD-123 1
2 SI2302 Q2 SOT-23_L2.9-W1.3-P0.95-LS2.4-BR 1
3 KF301-2P TEST KF301-2P 1
4 LMV358 U3 SOP-8_150MIL 1
5 OLED OLED1 I2C OLED 0.96" 128X64 1
6 5V1 D2 ZENER-SOD-123 1
7 100k R8,R7 0603 2
8 10k R12,R11,R1,R9,R2 0603 5
9 1k R13 0603 1
10 47k R10 0603 1
11 IRL540NPBF Q1 TO-220-3_L10.0-W4.5-P2.54-T 1
12 5A F1 F1206 1
13 ATtiny85 U1 SOIC-8_208MIL 1
14 USB PWR Connector USB USB PWR CONNECTOR 1
15 1u C3 0603 1
16 ICSP-6 ICSP ICSP-6 1
17 3x6x2.5 RESET,SET KEY-3.0*6.0 2
18 100n C5,C1,C6,C4 0603 4
19 47u C2 1206 1
20 10k R6 RES-ADJ-TH_3296X-8MM 1
21 Header FAN,NTC HEADER_2X1 2
22 R300 R3,R4,R5 2512 3
23 SS54 D1 DIODE-SMA(DO-214AC) 1

Attachments

None
Success
The owner does not allow comments in this project now

Comments (6)

johngr Reply

hello.hope you're ok...i was looking to built a li ion capacity meter and found this project .can you set the cut off voltage of the battery to be tested and leave it discharging and measuring the capacity of the battery? i have a lot of 18650 laptop batteries and a chinese module i have i dont think is very accurate. will this project do the job?thanks!!

Stefan Wagner Reply

@johngr Hi, this will not work in the way you want. The load is controlled by the poti, not by the MCU. What you can do is connecting the battery to the electronic load via one of these cheap protection circuits, they have a fixed cut off voltage depending on the protection chip. However, for a much better solution take a look at my Power Analyzer project which can offer all you want: https://easyeda.com/wagiminator/y-attiny814-power-analyzer

jamaimacyrus Reply

My brother is making a portable Bluetooth speaker from scratch for his 3rd-semester project. I saw him using this TinyLoad and I was impressed! But I want to know that is really a good idea to use TL in a portable speaker? I have told him that maybe he’s going overboard. So, can anyone (preferably someone who provides the best secondary data help) guide us?

Sylvia99 Reply

Not everyone can write a creative essayLack of time and writing skills are the main reasons why students always seek outside assistance with the most challenging papers. 

JamesGurney Reply

If Academon doesn't seem reliable for you, I recommend you to read some essay writing service reviews before. They can be quite useful to you in this situation.

BeckHassen Reply

Who can do my homework online for me ? I highly recommend to students Writepaperfor.me - amazing guys.

goToTop
你现在访问的是EasyEDA海外版,使用建立访问速度更快的国内版 https://lceda.cn(需要重新注册)
如果需要转移工程请在个人中心 - 工程 - 工程高级设置 - 下载工程,下载后在https://lceda.cn/editor 打开保存即可。
有问题联系QQ 3001956291 不再提醒
svg-battery svg-battery-wifi svg-books svg-more svg-paste svg-pencil svg-plant svg-ruler svg-share svg-user svg-logo-cn svg-double-arrow
We use cookies to offer you a better experience. Detailed information on the use of cookies on this website is provided in our Privacy Policy. By using this site, you consent to the use of our cookies.