Wiring a USB to TTL serial converter

I’m trying to write new firmware to my emonTH 2, but I can’t seem to connect correctly to the header on the board.

I have a couple of these - DSD TECH Official Website: USB to TTL Serial Converter to hand.

Based on the pin-outs here - emonth2/emonth_V2.0.2_sch.png at master · openenergymonitor/emonth2 · GitHub - it looks to me very much like I need to make these connections and I should be in business -
5V on the converter to 5V on the emonTH
GND on the converter to GND on the emonTH
TX on the converter to RX on the emonTH
RX on the converter to TX on the emonTH

Except it’s not working for me. I’ve connected the converter to my Linux machine and can see /dev/ttyUSB0 appear, so the PC can see the controller. However, when I open a serial monitor window I get nothing at all back. I’ve tried a bunch of baud rates but still no joy.

Can someone clarify what the correct settings (or process) are for making a serial connection to the emonTH please?

Thanks,

David

Have you made the mistake of believing the wrong labels on the emonTH’s FTDI connector?

Because if you have, you’ve connected Tx to Tx and Rx to Rx.

Way back in history, it must have seemed to be a good idea. Now, it’s a very big problem that continues to confuse everyone: Tx and Rx are swapped on the emonTx & emonTH pcbs, so as I’ve written so many times here, the emonTx is sending data on the pin labelled “Rx”, and it’s looking for data coming in on the pin labelled “Tx”. That’s contrary to convention (unless the emonTx is a modem!)

So, counting from the GND pin, the genuine pins are GND, CTS, VCC, Rx, Tx, DTR.

prog_pins

If you want to program it, DTR is the reset line and is driven by the FTDI programmer, so you’ll need that connection. It would appear that your converter lacks that, so you’ll be able to use it to receive data but not program the '328P.

You can check if you’ve got the TX and RX the correct way around by opening a serial terminal and looking for the data that the EmonTH occasionally spits out :+1:

I used a spare Arduino Mega to reprogram my EmonTH which you may want to try if you have one lying around, tie the reset pin of the mega to ground leaving the Mega board as a USB-TTL UART converter.
I reset the EmonTH just before the Arduino IDE was about to actually ‘upload’,
Cheers

Thanks both. It looks like I’m out of luck in terms of not having DTR. I’ll probably just buy the official FTDI programmer and then I’ll know I have the right equipment.

Tom - in order to get output (from the emonTH) on the serial connection do I just need to hook up TX->RX and RX->TX and no other connections? I think I saw somewhere that the connection needs to be set to 115200 baud, but I’ll check back and see if I can confirm it. Aha - presumably I can see it in the sketch where the serial connection is defined. I’ll check there and see how I get on.

David

[edit] to answer my own question - it’s 115200 baud
if (debug==1)
{
Serial.begin(115200);
Serial.println(“OpenEnergyMonitor.org”);
Serial.print(“emonTH FW: V”); Serial.println(version);
delay(100);
}
emonth2/src.ino at master · openenergymonitor/emonth2 · GitHub