All Projects → wagiminator → ATtiny85-USB-C-Tester

wagiminator / ATtiny85-USB-C-Tester

Licence: other
Simple USB-C Power Delivery Tester

Programming Languages

C++
36643 projects - #6 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to ATtiny85-USB-C-Tester

ATtiny85-TinyLoad
Electronic Dummy Load
Stars: ✭ 32 (+60%)
Mutual labels:  avr, attiny, pcb, project, diy, oled, attiny85
ATtiny85-TinyCharger
Single-Cell Li-Ion Battery Charger with Monitoring
Stars: ✭ 20 (+0%)
Mutual labels:  avr, attiny, pcb, diy, oled, attiny85, ina219
ATtiny85-TinyFMRadio
FM Radio with RDS
Stars: ✭ 51 (+155%)
Mutual labels:  avr, attiny, pcb, project, diy, oled, attiny85
ATtiny85-TinyDFPlayer
MP3-Player
Stars: ✭ 22 (+10%)
Mutual labels:  avr, attiny, pcb, project, diy, oled, attiny85
ATtiny13-TinyUPS
Uninterruptible Power Supply
Stars: ✭ 92 (+360%)
Mutual labels:  avr, attiny, pcb, project, diy
ATtiny13-TinyTacho
Simple RPM-Meter
Stars: ✭ 36 (+80%)
Mutual labels:  avr, pcb, project, diy, oled
ATtiny13-TinySolder
T12 Quick Heating Soldering Station
Stars: ✭ 45 (+125%)
Mutual labels:  avr, attiny, pcb, project, diy
ATtiny13-TinyRemoteXL
12-Button IR Remote Control
Stars: ✭ 33 (+65%)
Mutual labels:  avr, attiny, pcb, project, diy
ATtiny84-TinyCalibrator
OSC Calibrator and High-Voltage Fuse Resetter for 8-Pin ATtinys
Stars: ✭ 39 (+95%)
Mutual labels:  avr, attiny, oled, attiny85
Atmega Soldering Station
T12 Quick Heating Soldering Station
Stars: ✭ 183 (+815%)
Mutual labels:  avr, pcb, project, diy
DigiOS
Mini OS emulator for Digispark (an Attiny85 based microcontroller).
Stars: ✭ 46 (+130%)
Mutual labels:  avr, attiny, attiny85
smart-car-freescale
第九届飞思卡尔智能车参赛作品
Stars: ✭ 36 (+80%)
Mutual labels:  pcb, diy
LipSync
An open-source mouth operated sip and puff joystick that enables people with limited hand function emulate a mouse on their computer and/or smartphone.
Stars: ✭ 27 (+35%)
Mutual labels:  pcb, diy
chpc
CHPC: Cheap Heat Pump Controller
Stars: ✭ 27 (+35%)
Mutual labels:  pcb, diy
ES-Timer
A USB timer powered by Digispark ATtiny85 according to 🍅 pomodoro time management technique
Stars: ✭ 45 (+125%)
Mutual labels:  pcb, attiny85
djinn
Djinn Split Keyboard
Stars: ✭ 685 (+3325%)
Mutual labels:  pcb, diy
mechanical-keyboard
⌨️ Resources related to my mechanical keyboard build.
Stars: ✭ 14 (-30%)
Mutual labels:  project, diy
antispy-jammer
Simplest ultrasonic ANTISPY voice recording jammer based on ATTINY13 / ATTINY85 / ARDUINO with PAM8403 module driving piezo ultrasonic transducers (and optionally AD8933 signal generator)
Stars: ✭ 39 (+95%)
Mutual labels:  diy, attiny85
Xling
Xling, a pocket demon
Stars: ✭ 30 (+50%)
Mutual labels:  avr, oled
diy-BMS-with-Arduino-Nano
If you have a private powerwall of 18650 cells, this is the battery management system you need. The small PCB is equipped with the cheap Arduino Nano.
Stars: ✭ 33 (+65%)
Mutual labels:  pcb, diy

USB-C Power Delivery Tester based on ATtiny25/45/85

Simple USB-C Power Delivery Tester based on ATtiny25/45/85 and INA219. The device measures voltage, current, power, energy, capacity and displays the values on an OLED screen. You can switch between different screens by pressing the SET button.

pic1.jpg

Hardware

USB Connectors

The device is equipped with a USB-C receptacle (PCB version a) or plug (PCB version b) for the input and a USB-C receptacle for the output, so that it can be plugged between the power supply and the consumer. CC1 and CC2 communication channels are passed through so that supply and consumer can negotiate the bus power.

pic2.jpg pic4.jpg

Voltage and Current Measurement

An INA219 is used to measure voltage and current. The INA219 is a current shunt and power monitor with an I²C-compatible interface. The device monitors both shunt voltage drop and bus supply voltage, with programmable conversion times and filtering. A programmable calibration value, combined with an internal multiplier, enables direct readouts of current in amperes. The selected shunt resistance of 8mΩ enables both a very small influence on the circuit and a measurement with a resolution of 1mA. For an accurate measurement, a shunt resistor with a low tolerance (1% or better) should be selected.

User Interface

The user interface utilizes two buttons and a 128x64 pixels OLED display. An ATtiny24/45/85 microcontroller handles the user interface as well as the calculation and display of the values.

pic3.jpg

Software

Basic Principle

The INA219 continuously measures current and voltage and transmits the values to the ATtiny via I²C. From this, the ATtiny calculates the other values and displays them on the OLED screen.

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.

Accuracy of Time and Capacity Determination

The internal oscillator of the ATtiny is used to determine energy and capacity. The accuracy of the internal oscillator is +/-10% with the factory calibration. This can be improved to +/-2% or better by manual calibration. The calibration value determined in this way can be set in the source code.

Compiling and Uploading

Since there is no ICSP header on the board, you have to program the ATtiny either before soldering using an SOP adapter, or after soldering using an EEPROM clip. The AVR Programmer Adapter can help with this.

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: ATtiny25 or 45 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 ATtiny.
  • Go to Tools -> Programmer and select your ISP programmer (e.g. USBasp).
  • Go to Tools -> Burn Bootloader to burn the fuses.
  • Open USB_C_Tester 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 "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:usb_c_tester.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 ATtiny.
  • 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

  1. Connect the device between a power supply and a consumer. Due to the internal structure of the USB-C cables, it may be necessary to change the orientation of one of the cable plugs if you are using the 2-receptacle version of the device.
  2. Use the SET button to switch between the different screens.
  3. Use the RESET button to reset all values.

pic7.jpg pic8.jpg

Characteristics

Parameter Value
Voltage 5V - 20V
Current max 5A
Voltage Measurement Resolution 4mV
Current Measurement Resolution 1mA

References, Links and Notes

  1. UBS-A Version
  2. ATtiny25/45/85 Datasheet
  3. INA219 Datasheet
  4. SSD1306 Datasheet

pic5.jpg pic6.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/)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].