Counter-based Port Expansion for Arduino, ESP, Etc From Scrap.

by Northstrix in Circuits > Microcontrollers

285 Views, 2 Favorites, 0 Comments

Counter-based Port Expansion for Arduino, ESP, Etc From Scrap.

IMG_20210103_180643.jpg

This simple project will allow you to expand the number of available outputs on platforms like Arduino, ESP, etc.

How This Works

IMG_20210103_190050.jpg
IMG_20210103_190141.jpg
IMG_20210103_190030.jpg

A binary counter increments its internal state at each clock pulse. Latch changes its state when the synchronization pulse reaches high level. By connecting the inputs of latches (or registers) to the outputs of the counter and sending a certain amount of pulses to the counter. While the counter has already counted to the value that you need. Its possible to achieve the desired result at the outputs of the latches by sending a synchronization pulse to all latches at the same time.

Note: There are much better ways of expanding number of available ports. 74HC595N or MCP23017 are better suitable for this purpose. The goal of this project is to build a useful staff from scrap that would otherwise end up being stored in the box forever. You can easily expand the number of outputs to 32, 64 or even 128 by using this method, but I'm only going to demonstrate the concept here. For that reason (and because I don't have a larger breadboard) I'm only going to expand the number of outputs to 4.

Pick the Components

IMG_20210103_191613.jpg

1) MCU (Arduino, ESP, STM, or whatever)

2) Binary counter (or just build one yourself)

3) Either one 4-bit register or 4 latches or 4 flip-flops

4) * Couple of 4k - 10k resistors. In case the circuit will not work properly add two resistors between res and ground and/or ref and ground.

I've used K561IE10 as a binary counter and K555TM7 as 4 latches. You can also build the whole circuit using only NAND elements.

Flash Your MCU

IMG_20210103_191924.jpg

This code is so simple to have any compatibility issues. You can even run it on a toaster.

https://github.com/Northstrix/Counter-based_port_e...

Wire It Up!

counter-based_port_expansion_circuit.png

It's up to you now.

Enjoy the Result

IMG_20210103_180641.jpg
IMG_20210103_180640.jpg

Congratulations! You've learned how to utilize a staff from the late 70's and early 80's. And probably saved couple of dollars on new components.