ESP8266 vs serial ports

280 views
Skip to first unread message

Anna Christina

unread,
Mar 13, 2024, 6:49:37 AM3/13/24
to retro-comp
Hi,

for quite some time I often have a problem when connecting one of my Z80/Z180 machines (RC2014, SC126 and now also SC131) to a ESP8266 - and maybe someone can help me here.

My latest experience is:
I've flashed "ESPterm" to a ESP8266 (Wemos D1 mini) and added a logic level converter for 3,3V/5V level conversion to the Rx/Tx pins (and to 3V3, 5V and GND of the ESP).
(One of these: https://www.amazon.de/gp/product/B07Y81SYVX )

But now, when I connect Rx and Tx to the SC131, nothing is received by the ESP and displayed by ESPterm. But I noticed that I can transmit characters to the SC131, as the SD activity LED flashes eg. when entering "ZDE" to start it.

I've tested ESPterm by connecting Rx + Tx (after the logic level converter), and the characters are shown in the terminal window - so characters sent via Tx get received by Rx.
ESPterm does not use RTS/CTS handshaking, so I guess that's no problem. And AFAIK the SC131 default firmware also does not use RTS/CTS.

I also had similar problems before, eg. when trying the RC2014 wifi module in my original RC2014 - I simply could not get it to work with ZiModem or a similar firmware on it.

Are there any serial settings that have to be set in a ESP8266 firmware to make it work with a Z180 serial port or a SIO/2 serial port?

Thank you very much!

Regards,
Anna

Paul dB

unread,
Mar 13, 2024, 6:26:25 PM3/13/24
to retro-comp
Hi Anna Christina,

The symptoms you're describing sound familiar. A couple of years ago, I also spent some time interfacing a ESP8266 WEMOS D1 mini to my SC131. Searching the forum, I finally found the cause of the problem I had. Here's a quote from Steven Cousins: 

"The resistors in SC131 are relatively high values for maximum protection and work fine with all the Serial to USB adapters I've tried. However,  if the connected device loads the signals enough it would result in a failure of SC131 to output characters. You could try replacing the 2k2 resistors with, say, 1k resistors."

The quote above is from this topic.

Instead of replacing the resistors, which would have been a messy job, I added a transistor connected as a simple emitter-follower. That worked to convert the high impedance of the SC131 output to a low impedance at the ESP8266 input. Worked perfectly. I eventually built a small adapter out of a WEMOS D1 mini, a transistor emitter-follower and a darlington transistor (to pull down reset on command from ESPTerm - a great program btw).

If you're interested, I can see if I can find the circuit. I've got it on my NAS somewhere.

Hope that helps.

Regards,
Paul

Anna Christina

unread,
Mar 14, 2024, 8:17:44 AM3/14/24
to retro-comp
Hi Paul,

maybe that's the problem - I don't know. But it sounds plausible.

Could you post the circuit, so I could try to implement it on a breadboard and see if it helps me.
That would be great!

Thank you very much!

Regards,
Anna

Steve Clarke

unread,
Mar 14, 2024, 10:55:55 AM3/14/24
to retro-comp
I too would be interested in your circuit design as I have been wrestling with this exact issue with a zimodem esp set up for a while.

Many thanks,

S.

Paul dB

unread,
Mar 14, 2024, 6:21:56 PM3/14/24
to retro-comp
Took me a a while to find my notes. This circuit (and dongle) are really just a hack, or proof-of-concept, but it does work. It certainly isn't state-of-the-art (ha!). I've made some pictures to show details and the idea behind the dongle. It plugs into a serial port just as a normal wired USB-FTDI adapter would. 

FTDI-ESP8266_Dongle_circuit.pngFTDI-ESP8266_Dongle_layout.pngFTDI-ESP8266_Dongle_1.jpgFTDI-ESP8266_Dongle_2.jpgFTDI-ESP8266_Dongle_3.jpgFTDI-ESP8266_Dongle_4.jpgFTDI-ESP8266_Dongle_5.jpg

It's powered from the serial port (or possibly through the ESP8266 USB connector; it's been a while since I worked with it. YMMV). I've made the yellow flying lead to backplane RESET rather conspicuous in the picture just to show how the dongle can be used to reset the computer. ESPTerm (the excellent terminal program I'm using) has a function to toggle one of a couple of the ESP8266 pins just for that purpose. The Darlington transistor has high amplification that allows it to easily pull RESET to GND with just a few milliAmps of current to the transistor base.

The other transistor is connected as an emitter-follower (hey, old-school here!) and acts as a high impedance to low impedance converter. Check out Wikipedia for further info :). If the serial output from the computer is a bit too low,  an emitter-follower circuit can help compensate by increasing the drive current of the output.

I've used a bit of prototype board for the circuit, connected to the LOLIN ESP8266 board with some left over pins. I used a breadboard to line up the two boards, put pins through both, then soldered the pins; first on the top, then removing the (still) two loose pieces, turned them over to solder the other side. Just make sure to press the pieces together before soldering to make the joint solid.

Regarding both the circuit and dongle, I'm sure there is room for improvement. Any ideas or suggestions are welcome. Using SMT parts would probably be one obvious improvement, although I have to admit - I've never (yet) worked with them.

Any questions? Just ask :)

Paul

Paul dB

unread,
Mar 14, 2024, 7:53:01 PM3/14/24
to retro-comp
I should make a clarification to my previous post regarding powering the dongle. Of course the dongle gets its power through the serial connector; there is no jumper to disconnect it. I meant to add that, IF the computer isn't already powered by the usual means, it can (potentially) be powered through the USB connector on the LOLIN ESP8266 board. No guarantees though. Best to leave the USB unconnected, then there is no risk that the computer accidentally gets powered from *two* sources!

Something else I forgot to mention; the LOLIN board can be re-flashed with the add-on board in place. One thing that needs to be done when re-flashing is to put a jumper between TX and 5V on the 6-pin header otherwise RX on the LOLIN will be left floating and cause the flashing to fail. Perhaps a weak pull-up should be added to prevent that.

Thanks,
Paul

Anna Christina

unread,
Mar 23, 2024, 9:58:19 AM3/23/24
to retro-comp
Hi,

thank you all for your answers!

I tried another approach and switched from the Wemos D1 mini to a ESP-01, together with a 5V adapter module:

And now it is working just fine!

The only small "problem" that remains is that it seems that I cannot power the SC131 and the ESP-01 from just one PC USB port, eg. from a FTDI cable on the second SC131 serial port.
When trying this, the SC131 boots up to "checking ROM" and then reboots, maybe the reset circuit gets triggered.
But when powering the ESP-01 from a seperate USB port, it runs just fine.

Just FYI :)

Have a nice weekend!

Regards,
Anna

Paul dB

unread,
Mar 23, 2024, 4:19:07 PM3/23/24
to retro-comp
Hi Anna,

Thanks for getting back with your interesting solution. That's a handy 5V to 3V3 interface board for the ESP-01, and  I'm adding that to my list of useful gadgets :)

Regarding the booting problem when using one PC USB port to power both the ESP-01 and the SC131; that can easily cause, as you suspect, the voltage supervisor triggering. The max current output of "traditional" PC USB ports is 500mA. ESP8266 devices are known to draw extra current when transmitting. The USB port is probably limiting the excessive current. A small 5V power supply, like the 2.5A ones used to power a Raspberry Pi, would be ideal to power both the SC131 and the ESP01.

Note that a poor quality USB cable can have a noticeable voltage drop and cause similar problems. That can be easily tested by using another, preferably shorter USB cable to see if it makes a difference.

Regarding my original post, the convoluted dongle "solution", which I mainly focused on was probably overkill. Not really a simple circuit to breadboard like you asked for.

That got me thinking, so I decided to design a simple adapter to be put on a bit of prototype board, that will work the same way as my dongle but more easily wired up. Something to note with the circuit is that it automatically lowers the retro serial port 5V Tx output to roughly 3V. That's done by the 10K and 15K voltage divider feeding the transistor base, so no extra voltage conversion is needed. In the other direction, the ESP8266 Tx output voltage is high enough for the retro serial Rx port input. Putting a 3K3 or so resistor in series is good protection to limit any potential excessive current.

I'm including the layout of the adapter prototype here in case anyone else reading this topic is interested. The layout can easily be transferred to a breadboard for testing. If making the board, put the components on top and connect them with some wire on the bottom.
Retro_Serial_to_LOLIN_D1_mini_Adapter.jpg
Regards,
Paul

Paul dB

unread,
Mar 23, 2024, 5:52:13 PM3/23/24
to retro-comp
Oh, I forgot to add that 5V power to this adapter should come from the retro serial port. Powering it through the LOLIN D1 mini's USB connector won't work. I remember now that the 5V coming in that way goes through some circuitry on the mini, lowering the voltage to the "+5" pin (on the edge of the board) enough to cause problems. I would blame my old brain for forgetting, but that won't work; I've always been scatter-brained ;-)

Paul
Reply all
Reply to author
Forward
0 new messages