USBSerial

From Rev0 Wiki
Revision as of 18:43, 20 March 2019 by WikiSysop (talk | contribs)
Jump to navigation Jump to search

This is a project to create a low cost and versatile USB to serial adapter board based on the CH340G, with selectable (via slide switch) power and IO voltages (1.8, 2.5, 3.3, and 5V for both). Input and output protection is also provided via PTC fuses and series resistors + IO buffers.

Assembled USB to serial adapter board, top view.

List of Features

  • Supported Baud Rates: 50, 75, 100, 110, 134.5, 150, 300, 600, 900, 1200, 1800, 2400, 3600, 4800, 9600, 14400, 19200, 28800, 33600, 38400, 56000, 57600, 76800, 115200, 128000, 153600, 230400, 460800, 921600, 1500000, 2000000, 3000000 (not officially listed in datasheet, but tested functional)
  • Output Voltage (PWR pin): 5V, 3.3V, 2.5V, 1.8V
  • Output Current (PWR pin): 500mA
  • I/O Voltage (Tx pin): 5V, 3.3V, 2.5V, 1.8V
  • Input Voltage (Rx pin): 1.65 to 5.5V

Electronics

Buck Converter (Charger)

A simplified schematic of the buck converter that charges the 18650 from a 6-12V supply is shown in the thumbnail below:

Simplified buck circuit schematic for the CCR v2.0.

The input is decoupled with 220uF of electrolytic capacitors for each cell, total 440uF, plus 10uF of MLCCs for each cell. This is switched through an NCE30P12S P-channel MOSFET rated for up to 12A drain current, <25mOhm resistance at 4.5Vgs, and up to 3W power dissipation. Current is then supplied through 2 SS54 diodes in parallel during the off state, for up to 10A rated current at ~0.4Vf at 3A. The output is then filtered through another 440uF of electrolytic capacitors plus 10uF of MLCC.

Boost Converter (Discharger, regenerative)

A simplified schematic of the boost converter that discharges the 18650 into a 6-8.4V buffer pack is shown in the thumbnail below:

Simplified boost circuit schematic for the CCR v2.0.

The input is decoupled with 440uF of electrolytic capacitors plus 10uF of MLCC. This is switched to ground through an AO4406AL N-channel MOSFET rated for up to 13A drain current, <15.5mOhm resistance at 4.5Vgs, and up to 3W power dissipation. Current is carried through 2 SS54 diodes in parallel during the off state, for up to 10A rated current at ~0.4Vf at 3A. The output is then filtered through another 440uF of electrolytic capacitors plus 10uF x2 of MLCC.

CCR v1 Performance Evaluation

Buck (charging)/Boost (discharging) converter efficiency for the CCR v1.0.
Boost (discharging) mode operation at 1.5A, showing peak external transistor temperature of 57.8 C.

Constant Current Load (v2 Discharger, resistive)

A simplified schematic of the MOSFET + Op-Amp based circuit that discharges the 18650 is shown in the thumbnail below:

Simplified FET-based discharger schematic for the CCR v2.0.

The input is decoupled with 440uF of electrolytic capacitors plus 10uF of MLCC. This is discharged to ground through an IRF3710 N-channel MOSFET rated for up to 57A of drain current, ~17mOhm resistance at 4.5Vgs, and up to 200W power dissipation (limited to 21W for single channel based on 100x40x20mm heatsink + 40x40x20mm fan). Current measured across a 10mOhm shunt resistor is fed back to the Op-amp which compares it to a filtered PWM output from the STM32 microcontroller to control the current of the 18650. There is an additional input to the Op-amp to override the feedback and bias the MOSFET off (e.g. during charge or disconnected modes). The original circuit is credited to Youtuber VoltLog (video link) who reverse engineered a commonly sold "60W" constant current load and provided a detailed schematic. This circuit was prototyped on a proto board and then made into 2 standalone PCBs, one for through-hole kit form, and another small version using SMD parts.

Microcontroller

The CCR uses an STM32F103C8T6 microcontroller in the form of a "blue pill" board, which includes crystals, header pins, USB plug, and other supporting circuitry, and allows for the MCU to be swapped out in case of damage. Critically, the STM32F103 supports 8 12-bit ADC channels with fast read rate, 6 PWM channels operating at up to 360 kHz with 100 step PWM resolution, and built in USB PHY for communicating via virtual COM port to the PC.

CCR v2 Performance Evaluation

Charging mode ramp from 0 to 1A (CC).
Discharge current pulse of 1A for measuring cell IR.

The CCR v2 was assembled 2/15/19 and checked for basic operation cycle testing a Samsung 25R. Charging current is limited to approximately 2A due to power dissipation of the SOIC-8 P-channel MOSFETs. This may improve slightly with proper airflow routing using a 3D printed enclosure. Transient performance and current regulation were measured with a Rigol DS1052E. Discharge shows an overshoot of approximately 18% for 580us, and regulation of +/-3.8% at 1A. Charge shows no overshoot, and regulation of +/-3.9% at 1.5A.

Thermal image of the P-channel MOSFET at 180kHz switching frequency, 3.5A charging. Peak was 103 C from 12V supply.

Further investigation showed the MOSFET driver was not able to produce sharp edges, causing higher switching losses at 360 kHz. Changing the code to operate the MOSFETs at 180 kHz allows charging at up to 3.5A.

Hardware Revisions

Revision 1.0

The complete system schematic for the CCR v1.0.
The PCB layout (Gerber view from JLCPCB) for the CCR v1.0.

This is the first revision of the CCR, which only natively supports regenerative discharging mode.

Errata:

  • Pin A11 was used for the P-channel MOSFET control on cell 2, which is not usable for this function (pin is natively used as USB D+).
  • There are no pull-up/pull-down resistors to keep the buck/boost converter "safe" when in programming mode (IO in Hi-Z) or when no power is applied to USB
  • There is no power applied to the MCU when there is no USB plugged in
  • There is no PTC protection for the cell
  • Output of op-amp for voltage reading is 5V capable but going into 3.3V only ADC pin, needs series resistor to prevent damage

Revision 2.0

The complete system schematic for the CCR v2.0.
The PCB layout (Gerber view from JLCPCB) for the CCR v2.0.

This is the second revision of the CCR, which supports regenerative discharging mode (optional) as well as constant current discharging mode, and increased current capability of up to 3A in charge, and 5A (single channel)/3A (dual channel) in discharge.

Change List:

  • Added pull up/pull down resistors to "safe" the device when power is removed or reprogramming is taking place
  • Added PTCs to cell and buck circuit to prevent shoot through or shorting of the cell which led to many N-channel MOSFETs being destroyed on the prototype
  • Thermally isolated temperature sensor NTC from PCB ground plane by thin traces and cutout
  • Added silkscreen below SMD cell holder for better reliability against cell shorting of bare cells
  • Added pads and BOM option for external voltage sense wires for better accuracy in high current operation
  • Added SOIC-8 MOSFET placement options for higher current FETs to accommodate 3-6A charge capability
  • Added cutouts for a lever to pop the 18650 out of the cell holder
  • Added option for second thermistor (e.g. allowing 2 isolated heatsinks for significantly higher power capability in discharge)
  • Changed to WS2812B digitally controlled LEDs with option for external LED strip(s) or array

Errata:

  • Wrong silkscreen designator for C27 (reads R42)
  • Output of op-amp for voltage reading is 5V capable but going into 3.3V only ADC pin, needs series resistor to prevent damage
  • No pull down on fan control MOSFET causing fan to turn on during programming/reset
  • PB2/boot1 pin location on STM32 blue pill footprint is not correct, offset by about 1 pin width.

Revision 2.0

File:Ccr-v21 sch.png
The complete system schematic for the CCR v2.1.
File:Ccr-v21 both.png
The PCB layout (Gerber view from JLCPCB) for the CCR v2.1.

This is a minor update to the second revision of the CCR, to fix the errors found in V2.0 and add the option to chain 2 cells in parallel or link both slot chargers/dischargers to power a single cell at up to 7A (or 6A for discharge).

Change List:

  • Fixed C27 silkscreen
  • Added series resistor on Op-amp output to protect ADC input of STM32 module
  • Fixed PB2 pin location (offset in v2.0)*
  • Added pull down on fan control pin
  • Added pads to select single cell high power or 2 cell parallel operation*

Errata:

  • ...

PCB Files

Here is the Eagle schematic file for the CCR v1.0: http://rev0proto.com/files/tbd.sch Here is the Eagle board file for the CCR v1.0: http://rev0proto.com/files/tbd.brd

Here is the Eagle schematic file for the CCR v2.0: http://rev0proto.com/files/tbd.sch Here is the Eagle board file for the CCR v2.0: http://rev0proto.com/files/tbd.brd

Enclosure

The enclosure for the CCR v2.0 was created in Fusion 360 and is made up of x pieces which can be 3D printed and assembled with M3 screws.

Here are the Fusion 360 files for the CCR v2.0 enclosure: http://rev0proto.com/files/tbd.zip

Code

Full source code for the project can be found here: http://rev0proto.com/files/x.zip

Videos

<HTML5video type="youtube" width="400" height="300" autoplay="false">1SHY4jAfTcM</HTML5video>

Photos

Total Project Cost

EE Component Cost Source
OPA335 Zero-Drift Amplifier (qty 2) $2.42 LCSC
MCP1402 MOSFET Driver (qty 4) $1.83 LCSC
STM32F103 "Blue Pill" $1.82 Aliexpress
NCS199A1 Current Sense Amplifier (qty 2) $1.45 LCSC
18650 SMT Holder (qty 2) $1.23 Aliexpress
N-channel MOSFET 13A 11.5mOhm SOIC-8 (qty 4) $0.52 LCSC
rBOM (under $0.41) $4.76 LCSC
PCB $2.00 JLCPCB
Assembly $7.10 - $31.70 PCBgogo
HW Component Cost Source
100x40x20 Aluminum Heatsink $3.02 eBay
40x40x20 5V Fan $1.60 eBay
Misc HW (Under $0.22) $0.42 Aliexpress/eBay
Total Price $52.41 (Assembly cost $317, batch qty 10)