Arduino Nano CH340G 3.3 volt conversion

Arduino Nano Clone CH340G 3.3 volt conversion

This project, Arduino Nano CH340G 3.3 volt conversion, is more or less a finished projects but I’m submitting it here for an expert review, and in the hope that the contents, together with any comments that may accumulate, may also be useful to others.

As an introduction, I generally prefer the Nano to the Uno because it is less clumsy and I can put it directly into a fullsize breadboard for testing with other components.
The disadvantage is that the Nano has a poor 3.3 Volt output which is becoming significant because there are now many popular sensors, peripherals etc. which can’t tolerate 5 volts.
I also use Nanos for projects which are powered by plug in USB chargers where current consumption is not an issue, and because of the built in USB mini socket. Even better, the Chinese nano clones can be had for the price of a beer (well, that depends where you buy your beer, of course). These clones, incidentally, generally use the CH340G USB interface chip instead of the FTDI of the official version.

Having bought a stack of these Nano clones, I decided to convert one to 3.3 volts. I found some projects/information on the net, but most were focused on Nanos with the FTDI chip, but some useful stuff. The most useful documentation I found was :

  1. Schematic for Nano (CH340G version) by actrl.cz Arduino Nano CH340 – schematics and details – actrl.cz
  2. Data sheet for the CH340G CH340G Datasheet - USB to UART Interface - WCH

To convert this type of Nano to 3.3 volts, you just need a replacement regulator, a diode and some wire. I used a AMS1117 3v3 regulator and a 1N4004 diode (from my scrap box).
Two cuts on the circuit board are required and you’ll need some good soldering skills, which you may note from the supplied picture, that I have not fully acquired yet. So, to get started, simply make the two cuts on the circuit board, replace the regulator, glue the diode approximately in the place illustrated, then solder in the 4 connecting wires. And that is it. Well nearly.

You should (according to the datasheet) not run a 3v3 powered ATMEGA328P at 16MHz so you have at least 3 options:

  1. Ignore the advice and try anyway. Mine works OK according to the tests I tried.
  2. Set the fuses to ignore the external crystal/resonator and use the internal oscillator @8MHz using AVRDUDE etc. or create a new entry in the boards.txt file which is applied when you burn the bootloader, which you should do anyway. There are stacks of tutorials on how to bootload an Arduino. A sample boards.txt entry is below.
  3. Retain the usage of the 16 MHz crystal/resonator and create a boards.txt file which has a parameter to set the effective clock frequency to 8 MHz. This method requires that you include a short code fragment in any sketches which configure it for the prescaler settings used (code fragment below), otherwise timing sensitive things go wrong.

Caveat:
There may be a number of different clones out there, so you may have to adapt any changes accordingly. Watch for things like different regulator pin-outs etc.

Experience gained:
I had no success using the Arduino Uno as an ISP programmer to change fuses (AVRDUDE) and/or load the bootloader if I used its 3.3 Volt output to power the Nano. I assume that this is to because the pins are still at 5 volt. I had success though with a Uno clone, the Freaduino, which was switched to run fully at 3.3 volts. The Uno does of course work as an ISP programmer at 5 Volts, but since the CH340G now has its internal regulator bypassed (as the datasheet specifies) I didn’t want to do this (for too long). I also made some attempts with the Optiboot loader but did not get very far.
For this exercise, it’s better to get the Nanos which do not have pre-soldered headers. I’d probably also use thicker wire for the connections than the 0.19mm wire wrap specification stuff I’m currently using.

For the future:
There must be a market for someone who can create devices in the Nano format (breadboard friendly pins) with switchable 3v3 / 5v operation at (or near) Chinese prices. The nearest I have see is the Freaduino Micro http://www.elecfreaks.com/wiki/index.php?title=Freaduino_Micro but that is based on an ATmega32u4.

The following maybe required for 8MHz operation and have been collected from various sources

board.txt supplement (uno3-3v) for option 2. (internal 8Mhz oscillator)

###########################################################

uno3-3v.name=Arduino/3.3volt 8MHz internal

uno3-3v.upload.tool=avrdude
uno3-3v.upload.protocol=arduino
uno3-3v.upload.maximum_size=30720
uno3-3v.upload.maximum_data_size=2048
uno3-3v.upload.speed=57600

uno3-3v.bootloader.tool=avrdude
uno3-3v.bootloader.low_fuses=0xE2
uno3-3v.bootloader.high_fuses=0xDA
uno3-3v.bootloader.extended_fuses=0x06
uno3-3v.bootloader.unlock_bits=0x3F
uno3-3v.bootloader.lock_bits=0x0F
uno3-3v.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex

uno3-3v.build.mcu=atmega328p
uno3-3v.build.f_cpu=8000000L
uno3-3v.build.board=AVR_UNO
uno3-3v.build.core=arduino
uno3-3v.build.variant=standard

board.txt supplement (nano8) for option 3. (16 MHz external / 8MHz after prescaler)

###########################################################

nano8.name=Arduino Nano 8 MHz (external 16 MHz Xtal)

nano8.upload.tool=avrdude
nano8.upload.protocol=arduino

nano8.bootloader.tool=avrdude
nano8.bootloader.unlock_bits=0x3F
nano8.bootloader.lock_bits=0x0F

nano8.build.mcu=atmega328p
nano8.build.f_cpu=8000000L
nano8.build.board=AVR_NANO
nano8.build.core=arduino
nano8.build.variant=eightanaloginputs

nano8.upload.maximum_size=30720
nano8.upload.maximum_data_size=2048
nano8.upload.speed=57600

nano8.bootloader.low_fuses=0xFF
nano8.bootloader.high_fuses=0xDA
nano8.bootloader.extended_fuses=0x06
nano8.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex

Sample code template for compatibility with option 3. (16 MHz external / 8MHz after prescaler)

#include <avr/power.h>

void setup() {
  
  // prescaler from http://forum.arduino.cc/index.php?topic=271364.0
  // combined with "board" and selected clock frequency.
  // locate early in script

  if (F_CPU == 8000000) clock_prescale_set(clock_div_2);
  else if (F_CPU == 4000000) clock_prescale_set(clock_div_4);
  else if (F_CPU == 2000000) clock_prescale_set(clock_div_8);
  else if (F_CPU == 1000000) clock_prescale_set(clock_div_16);
  
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

Attachments

  1. Schematic adapted for a 3.3 volt version of the Nano CH340G
  2. Nano Board underside semi-graphic with annotations and change marks
  3. Nano Board underside photo with changes applied
  4. Nano CH340G Board top side (for identification)

I made the changes this way and didn’t include the diode in the Vin path.

For the 8MHz version I simply loaded the bootloader of the “Arduino Pro Mini 8MHz 3V3” Version and set in the IDE the Board to “Pro Mini” and the Prozessor to “ATmega328 (3.3V 8MHz)”. This setting allow the standard use of the IDE without any other change for the Nano with 3V3 and 8MHz.
:slight_smile:

_20180204_120856.jpg

_20180204_120918.jpg

_20180204_120945.jpg

of course it works even in 2020. thanks