Skip to content

MyRaspberry/PICO_W_PID

Repository files navigation

PID-project

PICO W Circuit Python

new ( 3.1.2024 )

PICO W Arduino IDE 2.2.1

ESP32-S3 Arduino IDE 2.3

  • webserver ( RTC from NTP )
  • analog in
  • digital out pwm
  • PID
  • MQTT to local broker
    • MQTT with Secure Server and MQTT lib v2.5.2 to HIVEMQ with TLS

RPI4: MQTT broker & Node-Red & SQLite for Current and Hist Trend

  • fix IP 192.168.1.4 on ethernet port / cable
  • Mosquitto MQTT broker ( no TLS / password protected ) ( v2.0.11 )
  • SQLite3 ( v3.40.1 )
  • Node ( v20.10.0 )
  • Node-Red ( v3.1.0 )

add sideproject:

PMS1W PoorManScope 1channel WiFi

PICO W CP829

ESP-32-S3 Arduino

PICO W Arduino

project info

see phone browser
see V102 from PC
see V110 NR&wwww
see ESP32-S3 Arduino IDE

see PICOW CP829 PMS1W
see ESP32-S3 PMS1W

  • v1.0.1b PreRelease
  • v1.0.2b Release
  • v1.1.0 MQTT ( no TLS ) Release
  • v1.1.1 update to CP900a6 work on PICO_W code
  • v1.1.2 back to CP829 and use mem_free report for each import "DIAGM" in settings.toml
  • v1.1.3 delete datetime lib use time lib only ( +26kB mem )

board: PICO W
used system files:

adafruit-circuitpython-raspberry_pi_pico_w-en_US-20231205-no-branch-156f417.uf2
adafruit-circuitpython-bundle-9.x-mpy-20231205.zip
flash_nuke.uf2

read back after nuke & flash:

see: boot_out.txt

Adafruit CircuitPython 9.0.0-alpha.5-34-g156f417f70 on 2023-12-05;
Raspberry Pi Pico W with rp2040
Board ID:raspberry_pi_pico_w

the in this project used Python PID code is from:
m-lundberg/simple-pid
MIT lic.


maker

by: kll engineering
lic: CC-BY-SA 4.0
date: 11.12.23
place: CNX
blog: myBlog PICO_W PID artcle


HOW TO

  • 1
    get a PICO W board with WIFI 6$ and HEADERS ( if you not want to solder 7$ )
    PICO W board

  • 2
    connect it with a USB cable ( USB A to Micro-USB-B cable ) to a PC USB port
    and see drive content INDEX.HTM, INFO_UF2.TXT ( with bootloader info )
    later you will need to press the [BOOT-SEL] button while connecting to see that drive again

  • 3
    open 2 file explorer windows and copy like drag / drop
    -a- flash_nuke.uf2 ( required only if you change CPxxx version )
    -b- adafruit-circuitpython-raspberry_pi_pico_w-< LANGUAGE >< DATE >< VERSION >.uf2 to it
    after copy the drive will close and after 5sec drive show up again: 'CIRCUITPY'
    pls find there boot_out.txt and check

  • 4
    you could start now edit 'code.py' with MU-Editor, but here we
    delete the empty code.py and settings.toml
    and copy / drag our new files and /lib/

  • 5
    open MU-Editor ( mode circuitpython )( should auto find that drive and open code.py )
    activate the serial TAB aka REPL console ( use [CTRL][c] for stop / [CTRL][d] for reboot )
    now develop code directly on the board
    BUT: can not edit settings.toml on the board! ( reboot failure might happen )
    that file only edit on the PC ( like with notepad )( like add your wifi login SSID PASSWORD )
    and copy it to the board

  • 6
    good project code backup / upload to your PC
    keep zips for each version

  • 7
    System files download
    might want to check if there is a update on the core files,
    download CPxxx.uf2 and adafruit-circuitpython-bundle_lib.zip

  • 7a- backup all your code

  • 7b- nuke the board

  • 7c- flash the board with the new CPxxx.uf2

  • 7d- copy back your code ( not the /lib/ )

  • 7e- with the new lib.zip
    copy / unzip from it new versions of the same libs used in that project
    ( here /adafruit_httpserver/ )

  • 7f- expect to now find code errors old code .vs. new libs
    and find new lib doc online to fix

  • 8
    after first edit settings.toml for SSID & SSID password and wanted FIX IP
    open any browser ( inside your LAN ) http://192.168.1.215 and test operation
    ( OUT & SP number or mouse input and [ENTER] as submit )
    ( see also MU-REPL for diagnostic prints "www ...." )

  • 9
    after website operation checked and coding work finished ( incl backup )
    you can disconnect the USB cable from PC and use a USB charger to power the board
    ( place anywhere inside your LANs WIFI area)

  • 10
    hardware: PID needs a
    *input for PV: connect a SENSOR on ADC0
    but you could also use 'linked' sensor boards..
    *output from OUT: here use a LED to see the 'dimmed' control output
    later can connect like a SERVO ... for real process control