PlatformIO Community

Adapt MCU UART to 1-wire devices (more reliable than bit-bang solutions)

MCUs have logic blocks with shift registers for serial such as I2C, SPI, and UART. However, there is no such support for 1-wire. Arduino and others use bit-bang solutions to support 1-wire devices such as DS18B20. This is ok for very simple projects but may be buggy for interesting MCU loads because of disabling interrupts and/or spinlocks.

An Maxim application note says that UART can drive 1-wire. Indeed it does and there is no tinkering with interrupts.

My project is found at The documentation is in the Changelog in plain text marked up for Doxygen which indexes and cross-references everything including a KiCad schematic.

The platformIO.ini has ESP32 and MEGA2560. There is a Bash script for each board with a menu loop to reduce retyping commands.

Questions or suggestions are welcome.


1 Like

I added NodeMcu8266 to the platformio.ini so now it is usable for 3 different MCUs. There is an optional menu script to select which MCU is updated.

platform = espressif32
board = featheresp32
framework = arduino
;; select the Adafruit Feather 32
build_flags =
   -D USE_MCU=1

platform = atmelavr
board = megaatmega2560
framework = arduino
;; select the mega2560
build_flags =
   -D USE_MCU=2

platform = espressif8266
board = nodemcuv2
framework = arduino
;; select the NodeMcu8266ex
build_flags =
   -D USE_MCU=3


PS3="Select option for ${BRD}..."

select opt in Init Upload Quit; do

case $opt in
     echo "Init..."
     pio project init -b ${BRD}

     echo "Upload..."
     pio run -e ${BRD} --target upload

      echo "Goodbye..."