AVR Multi-Tool Learns The Latest Tricks

Like many of us who fiddle with microcontrollers, [Mike] and [Brian] often found themselves using an ISP programmer and a USB-to-serial adapter. But when they started working on the latest generation of ATtiny chips, they found themselves in need of a Unified Program, and Debug Interface (UPDI) programmer as well. So they decided to wrap all three functions into one handy open hardware gadget.

They call their creation the AVR General Purpose Programmer, or AVRgpp for short. It runs on an ATmega328P with a Pro Mini bootloader, which means that the programmer itself is fully compatible with the Arduino IDE. USB-to-serial capability is provided by a CH330N, and a MC14053 digital switch IC is used to select between talking to the AVRgpp’s onboard MCU or the target device.

A 128 x 32 I2C OLED and two push buttons are used to select the device’s current mode, and there’s a physical switch to select between 5 V or 3.3 V power for the target. There’s also a ST662 12 V regulator, as UPDI targets occasionally need a high voltage pulse to switch into programming mode. Everything is packaged up in a pocket-sized laser cut enclosure that you can easily toss in your bag.

[Mike] and [Brian] say they are considering putting the AVRgpp into small scale production if there’s enough interest, so let them know if you’d like to get one without having to build it yourself.

An ESP8266 Environmental Monitor In Your USB Port

At this point, we’ve all seen enough ESP8266 “weather stations” to know the drill: you just put the ESP and a temperature sensor inside a 3D printed case, and let all those glorious Internet Points™ flow right on in. It’s a simple, and perhaps more importantly practical, project that seems to never get old. But that doesn’t mean there isn’t room for innovation.

Annoyed by the unnecessary bulk of existing solutions, [cperiod] has come up with an ESP8266 temperature and humidity sensor that can plug directly into a standard USB port. Slotted into a USB wall charger or power bank, this diminutive board can provide inconspicuous remote environmental monitoring wherever you need it. For extra hacker points, the board was even produced at home on a PCB mill.

In addition to the ESP-7 or 12 module (which plugs in via a header, should you need to swap it out), the board features a CH330N USB to UART chip and HT7233 voltage regulator. For the sensor itself, [cperiod] has bucked convention a bit and went with the I2C-connected AHT10 over something more common like a member of the BME family.

Unfortunately, this design suffers from the same issue we’ve seen in other compact environmental monitoring solutions; namely, that the heat generated by the chip itself skews the temperature readings. To combat this, aggressive power saving functions are baked into the firmware to make sure the ESP is in a deep sleep as much as possible. While not a perfect solution, it does prevent the ESP from warming the PCB up so much that it invalidades the reported data.

By now, the particularly astute reader may have realized that all the additional components used for the USB side of this board aren’t strictly necessary. After all, if you can pull the ESP module out of the header and program it separately, then you don’t actually need to include that capability in each sensor node. While true, we’re hardly the ones to complain when a hacker showboats a bit on their designs.

New Part Day: The Fifty Cent USB Chip

If you want to plug a USB cable into your next project, you’ve got a problem. USB is not UART, and UART is what every microcontroller serial port wants. To add USB to your microcontroller project, you’ll need to add a support chip, probably from FTDI, although there are a multitude of almost-FTDI clones available from the other parts of the Internet. These parts are slightly expensive, and they require some support circuitry. What you really need is a simple device that requires minimal external components, takes in serial from your microcontroller and spits out USB, and costs no more than a dollar. Bonus points if it’s hand-solderable.

The CH330 is apparently the answer to this problem (That’s a TaoBao link, this is probably going to be the best link going forward). It’s a dead simple chip with eight pins. Two are the data lines on a USB cable, and two are TX and RX for your microcontroller. The other pins are just power, ground, and an RTS line. Best of all, it only costs about fifty cents. You’ve never heard about it, because a few hours after this post is published, it will be the most information you’re going to get on this chip in the English-speaking world.

As far as we can tell, the CH330 is the smallest in a line of USB to UART converters from WCH, although the part isn’t even on the company’s website. The first reference to the phrase ‘CH330’ in reference to a USB chip appeared about a month ago, at the beginning of September. There’s a GitHub for someone who is apparently using this chip in a Pine64 board, but that’s about it. There’s no more information.

Right now, the only documentation for this chip is a single Chinese-language datasheet with an example schematic showing this chip connected to a MAX232 as a USB to RS232 converter. This is it. You’re looking at all the information that exists on this chip in the English-speaking version of the Internet.

The idea of a cheap, small chip that easily turns USB into UART would be great for thousands of projects. An FTDI chip will work, yes, but if you’re making thousands of a thing you might want to go with the fifty cent part over the two dollar part. That said, we’re in untested waters with this part, and you can’t even find it on AliExpress.

Let us know if you’ve gotten your hands on one of these devices. This has the potential to be really useful in a lot of projects and products, and we’re eager to see what the community comes up with. Thanks to [acabx] for sending this one in on the tip line.