Chat freely about anything...

User avatar
By Luc Volders
#81738 I found an easy way to get loads of output pins on an ESP8266 but it is also usable for ESP32, Arduino, Microbit etc.

This is not using the 74X595 but I am using the WS2811 chips. Cheap, easy to use and expand.
The fun is that you can use PWM on them so you can get loads of output ports with PWM with almost no effort. Just use the neopixel library.

ESPWS01.jpg


I give you some example programs in ESPBasic and in Lua. Arduino code in next part. So keep reading.

WS2811-003.jpg


Source code and hardware schematics on my weblog:
https://lucstechblog.blogspot.com/2019/ ... ur_12.html

I wonder why nobody did this befoer (as far as I know).

Luc
User avatar
By eriksl
#81883 It's an interesting thought, but a few notes:

- I seem to have understood you're connecting a relay to the ledpixel. I wouldn't do that, if only for the amount of current it draws and the backcurrent from the coil when released. I also happen to dislike relays anyway ;-)
- from my own experience: max span between two ledpixel is about 3 meters. You can stretch that to many more meters (I haven't met the limit yet) by making the ledpixel control a mosfet gate driver. The mosfet gate driver has a schmitt trigger on it's input, to prevent noise being transferred and it drives the output very hard to gnd or Vcc, which is exactly what you want, to overcome the capacitance of the cabling, at these frequencies.
- I think using a ledpixel for PWM has somewhat limited use for PWM because the refresh is good, but the width is very limited (8 bits), too small for me. When I want an arbitrary amount of inputs or outputs, I just use I2C I/O expanders. Especially those from Microchip are very handy and only cost a few bucks for five pieces.