User Tools

Site Tools


arduino:wio-en

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
arduino:wio-en [2020/07/03 17:13] – [Libraries] rjversluisarduino:wio-en [2024/03/23 08:03] (current) – [Mobile] rjversluis
Line 1: Line 1:
 +[[:english|{{ :hardware.png}}]][[:english|{{ :rocrail-logo-32.png}}]]
 [[:arduino:wio-fr|{{ icons:fr.png|French Version}}]][[:arduino:wio-de|{{ icons:de.png|Deutsche Version}}]][[:arduino:wio-en|{{ icons:uk.png|English Version}}]] [[:arduino:wio-fr|{{ icons:fr.png|French Version}}]][[:arduino:wio-de|{{ icons:de.png|Deutsche Version}}]][[:arduino:wio-en|{{ icons:uk.png|English Version}}]]
-====== WIO - Throttle - 32 I/O - LEDs - Servos - RFID - Displays - DCC ====== +====== WIO Firmware ====== 
-[[:english|{{ :hardware.png}}]][[:english|{{ :rocrail-logo-35.png}}]] +[[:wio:overview-en|{{ :wio:wiologo.png}}]] 
-[[:english|Content]] -> [[:hardware-en#arduino|Arduino]] +[[:english|Content]] -> [[:arduino:wio-overview-en|WIO Overview]] 
-  * [[:arduino:wio-overview-en|WIO Overview]] | [[:arduino:wio-setup-en|WIO Setup]] | [[:arduino:wioctrl-en|WIO Control]] | [[:arduino:amp-en|User Bitmaps]] | **[[:arduino:wio-en|WIO Firmware]]** | [[:arduino:wio-cam-en|WIO CAM]]+  * [[:arduino:wio-overview-en|WIO Overview]] | [[:arduino:wio-setup-en|WIO Setup]] | [[:arduino:wioctrl-en|WIO Control]] | [[:arduino:amp-en|User Bitmaps]] | **[[:arduino:wio-en|WIO Firmware]]** | [[:wio:wio-ledscript-en|LEDScript]] | [[:wio:wio-ioscript-en|IOScript]]
   * [[:arduino:wio-rascii-en|WIO RASCII]] | [[:arduino:wio-canprot-en|WIO CAN Protocol]]   * [[:arduino:wio-rascii-en|WIO RASCII]] | [[:arduino:wio-canprot-en|WIO CAN Protocol]]
- \\ +  * [[https://i2cdevices.org/addresses|I2C Device Addresses]]
-{{ :arduino:rici-proto.png?0x400}}{{  :arduino:wio_01_v2._pict3.jpg?250}} +
-^  W o r k - I n - P r o g r e s s  ^+
  
  \\  \\
 =====Introduction===== =====Introduction=====
-This solution is based on the ESP8266/ESP32 family.\\+This project is targeted to the ESP8266ESP32 and RP2040((Raspberry Pi PicoW)) platforms.\\ 
 +The source code is only available to be able to flash it on the target device if no other method is possible.\\ 
 +Forking or manipulating the source code is NOT allowed and is protected by copyright.\\
  
 It can be used as: It can be used as:
Line 32: Line 33:
   * Lolin D32   * Lolin D32
   * ESP32 Dev Module   * ESP32 Dev Module
-  * ESP32 CAM Module+  * ESP32 D1 Mini
  
-====Used ESP Pins====+====Used Pins====
 Check the pin mapping in Pins.cpp: Check the pin mapping in Pins.cpp:
   * https://gitlab.com/rocrail/wio/-/blob/master/Pins.cpp   * https://gitlab.com/rocrail/wio/-/blob/master/Pins.cpp
  
 ====Flyer==== ====Flyer====
-  * https://gitlab.com/rocrail/wio/blob/master/docu/WIO.odp+  * https://gitlab.com/rocrail/wio/-/blob/master/docu/WIO-2.pdf
  
  \\  \\
Line 53: Line 54:
  
  \\  \\
-=====Arduino IDE 1.8.12===== +=====Arduino IDE=====
-:!: 1.8.11 does not work! Event the BasicOTA example will not compile...\\ +
-  * https://www.arduino.cc/en/Main/OldSoftwareReleases#previous+
 Prepare the Arduino IDE with the following boards and libraries: Prepare the Arduino IDE with the following boards and libraries:
-====Board manager===== +====Boards Manager===== 
-Add in the preference dialog to "Additional board manager" the following URL:+Add in the preference dialog to "Additional Boards Manager" the following URL's:
 <code> <code>
-https://arduino.esp8266.com/stable/package_esp8266com_index.jsonhttps://dl.espressif.com/dl/package_esp32_index.json+https://arduino.esp8266.com/stable/package_esp8266com_index.json 
 +https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
 </code> </code>
 +
 {{ :arduino:board-manager-en.png?300}} {{ :arduino:board-manager-en.png?300}}
-And install the ESP8266 board library.\\+And install the ESP8266 and ESP32 Boards.\\
 ====Board selection==== ====Board selection====
 {{ :arduino:lolin-ide-board.png?240}} {{ :arduino:lolin-ide-board.png?240}}
Line 70: Line 71:
 ====Libraries==== ====Libraries====
 ===ESP8266 & ESP32=== ===ESP8266 & ESP32===
-  * ESP8266 (Board Manager) \\ :!: Stick with version **2.5.2** because there are unsolved issues with version 2.6.x. +  * ESP8266 (Board Manager) 
-  * Wire (I2C+  * Adafruit NeoPixel (WS2812)
-  * FastLED (WS2812)+
   * RotaryEncoder   * RotaryEncoder
   * MFRC522 (RC522)   * MFRC522 (RC522)
   * Servo   * Servo
   * ArduinoOTA   * ArduinoOTA
-  * MCP_CAN +  * mcp_can 
     * https://github.com/coryjfowler/MCP_CAN_lib     * https://github.com/coryjfowler/MCP_CAN_lib
     * [[:arduino:rcan-en#modifications|MCP_CAN modifications]]     * [[:arduino:rcan-en#modifications|MCP_CAN modifications]]
-  * NTPClient+  * SparkFun APDS9960 RGB and Gesture Sensor \\ Line 198 in the Arduino/libraries/SparkFun_APDS9960.h must be changed from NA_STATE into NO_STATE because it conflicts with the WiFi RP2040 library. This Enum value ist not used in the Arduino/libraries/SparkFun_APDS9960.cpp. (implementation) 
 + 
 ===ESP32=== ===ESP32===
   * ESP32 (Board Manager)   * ESP32 (Board Manager)
Line 89: Line 91:
 __**ESP32CAN Modifications**__\\ __**ESP32CAN Modifications**__\\
 The ''xSemaphoreTake'' should timeout after 500ms instead of wait for ever.\\ The ''xSemaphoreTake'' should timeout after 500ms instead of wait for ever.\\
-Replace ''portMAX_DELAY'' with 500, and return the rc of the ''xSemaphoreTake'' function instead of zero.+Replace ''portMAX_DELAY'' with 500, and return the rc of the ''xSemaphoreTake'' function instead of zero. (CAN.c)
 <code c> <code c>
 int CAN_write_frame(const CAN_frame_t *p_frame) { int CAN_write_frame(const CAN_frame_t *p_frame) {
Line 108: Line 110:
  \\  \\
  
-====SPIFFS==== +====FileSystem==== 
-Select 2M SPIFFS size:\\ +Select 1M FS size:\\ 
-{{:arduino:arduino-esp8266-spiffs-2m.png?400}}\\ +{{:arduino:esp8266-fs-size.png?240}}\\ 
-SPIFFS is a file system which can be used in WIO for uploading user bitmaps.\\+LittleFS is a file system which can be used in WIO for uploading user bitmaps and scripts.\\
 Installing the Arduino IDE Plugin for uploading data: Installing the Arduino IDE Plugin for uploading data:
   * https://github.com/esp8266/arduino-esp8266fs-plugin   * https://github.com/esp8266/arduino-esp8266fs-plugin
  
-====Dark Theme==== 
-For those who wants a Dark Theme for the Arduino IDE: 
-  * https://github.com/konrad91/OneDarkArduino 
  
- \\ 
 =====WIO Sketch===== =====WIO Sketch=====
-| //Copyright (c) 2002-2020 Robert Jan Versluis, Rocrail.net// |+| //Copyright (c) 2002-2022 Robert Jan Versluis, Rocrail.net// |
 WIO is firmware for controlling Throttle, I2C, LEDs, Servos, RFID, Displays and DCC.\\ WIO is firmware for controlling Throttle, I2C, LEDs, Servos, RFID, Displays and DCC.\\
-  * https://gitlab.com/rocrail/wio 
   * [[https://gitlab.com/rocrail/wio/-/archive/master/wio-master.zip|Download as Zip]]   * [[https://gitlab.com/rocrail/wio/-/archive/master/wio-master.zip|Download as Zip]]
 +  * Clone the repository: (WIO with capitals!)\\ <code>git clone https://gitlab.com/rocrail/WIO.git</code>
   * [[https://gitlab.com/rocrail/wio/-/network/master|Change Log]]   * [[https://gitlab.com/rocrail/wio/-/network/master|Change Log]]
-The source code is public but not open source licensed, and it should be used only to compile and load it on the LOLIN D1 Mini.\\+The source code is public but not open source licensed, and it should be used only to compile and load it on the LOLIN D1 Mini or D32.\\
  
-:!: **Note:** After unpacking the ZIP the folder should be renamed before loading it into the Arduino IDE from "wio-master" into "WIO".\\+ 
 +__**IMPORTANT**__ 
 +^ :!::!::!: The directory MUST be renamed after unpacking the ZIP from "wio-master" into "WIO":!::!::!: ^\\ 
 +The sources are unusable in the Arduino IDE without renaming the main source directory, and will bring only a mess of compile errors!\\ 
 +\\ 
 +(**Important:** The USB cable has to be a data cable, a charging-only cable doesn't work) 
 +\\ 
 +\\
 ====Binary==== ====Binary====
-{{ :arduino:esp-downloadtool.jpg?400}}+{{ :arduino:esp-downloadtool.jpg?400}}{{ :arduino:espressif_flash_tool_chip.jpg?150}}{{ :arduino:espressif_flash_tool.jpg?300}}
 Use the Espressif tool to upload the WIO Binary. Use the Espressif tool to upload the WIO Binary.
-  * [[https://gitlab.com/rocrail/wio/-/blob/master/WIO.ino.d1_mini.bin|WIO Binary]]+  * [[https://gitlab.com/rocrail/wio|WIO Binaries]]
   * [[https://www.espressif.com/en/support/download/other-tools|ESP Flash Download Tool]]   * [[https://www.espressif.com/en/support/download/other-tools|ESP Flash Download Tool]]
     * :!: Do not uncheck "DoNotChgBin"     * :!: Do not uncheck "DoNotChgBin"
Line 161: Line 166:
 Output after a ? command:\\ Output after a ? command:\\
 <code> <code>
-Settings: 
 ------------------------------ ------------------------------
-version=0.85 WIO 20191031d (c)Rocrail +revision=458 WIO (c)Rocrail 
-ssid=xxxxxxxx +192.168.100.175 RSSI=-52 
-pwd=xxxxxxxx +battery=186 
-server=xxxxxxxx +EEPROM size=3804 
-port=8051 +Free heap=174271 
-name= +I/O state=00 00 00 00 
-id=33 +------------------------------ 
-io=i2cdcc +SPIFFS total=1345kb used=0kb 
-i2c=ooooooooooooooooppppiiiibbbbbbbb +file: Disco01.led size=110 
-steps=50 +------------------------------ 
-pulse=50 +Configuration: 
-display=22 +------------------------------ 
-dccsc=0+ssid1= 
 +pwd1= 
 +ssid2= 
 +pwd2= 
 +server
 +name=[local] 
 +id=45 
 +io=i2cled  
 +i2c=ooooooooiiiiiiii 
 +steps=64 
 +sleeptimer=5 
 +pulse=5 
 +pwmsize=0 
 +options=0xC2 0x01 0x00 0x00 
 +booster=0 
 +board=1 
 +display=3
 railcom=0 railcom=0
-maxpower=0 +id12=0 
-RSSI=-53 +depart=0 
-MCP23017 status: 0x20=OK 0x21=OK +stepper=
-I2C device found at address 0x20 +canprot=0(0) 
-I2C device found at address 0x21 +canio=0 
-I2C device found at address 0x3C +canusb=0 
-I2C found 3 devices +trace=0
-loco1=0 loco2=3 active=0 +
- +
-Change settings by typing:+
 ------------------------------ ------------------------------
-*ssid=<your WiFi SSID> 
-*pwd=<your WiFi password> 
-*server=<your Rocrail server IP/host> 
-*port=<your Rocrail server port> 
-*name=<Node name> 
-*id=<Node number> 
-*io=<type> <throttle> or <i2cled> or <i2cservo> or <i2crfid> or <i2cdcc> or <i2cmobile> 
-*i2c=<oooooooobbbbbbbboooooooobbbbbbbb> o=output, i=input, b=block, p=pulse 
-*steps=<number of rotary steps> 
-*pulse=<output pulse length in 100ms units> 
 </code> </code>
  
Line 212: Line 219:
   - If RailCom has been activated the baudrate switches automatically to 250000 and the Serial Monitor is read only.   - If RailCom has been activated the baudrate switches automatically to 250000 and the Serial Monitor is read only.
   - If ID12 has been activated the baudrate switches automatically to 9600 and the Serial Monitor is read only.   - If ID12 has been activated the baudrate switches automatically to 9600 and the Serial Monitor is read only.
 +
 +Basic connection setup can also be done on the __**[[:arduino:wio-setup-en#maintenance|Maintenance Tab]]**__ of the WIO Setup Dialog.\\
  
 ^ Command ^ Description ^ Default ^ Remark ^ ^ Command ^ Description ^ Default ^ Remark ^
 | ?  | Shows the current settings and how to change them. | | ?  | Shows the current settings and how to change them. |
 | !  | Dumps the used Flash memory. | | !  | Dumps the used Flash memory. |
-| *ssid=<value> | Set the WiFi access point SSID. | - | Primary SSID | +| *sod | Force Start of Day | 
-| *pwd=<value> | Set the WiFi password. A WiFi reconnect is triggered. | - | Primary WiFi password | +| *scan | List all available WiFi APs | 
-| *ssid2=<value> | Set the WiFi access point SSID. | - | Alternative SSID | +| *ssid1=<value> | Set the WiFi access point SSID. | - | Primary SSID (max. 30 characters) 
-| *pwd2=<value> | Set the WiFi password. A WiFi reconnect is triggered. | - | Alternative WiFi password | +| *pwd1=<value> | Set the WiFi password. A WiFi reconnect is triggered. | - | Primary WiFi password (max. 30 characters) 
-| *server=<value> | Set the Rocrail Sever IP or Name. | - | Maybe a CSV of max 32 characters.(1.71+) \\ Example: "mba2019,win2019"+| *ssid2=<value> | Set the WiFi access point SSID. | - | Alternative SSID (max. 30 characters) 
-| *port=<value> | Set the Rocrail Sever port. | 8051 |+| *pwd2=<value> | Set the WiFi password. A WiFi reconnect is triggered. | - | Alternative WiFi password (max. 30 characters) 
 +| *server=<value> | Set the Rocrail Sever IP or Name. | - | May be a CSV of max 30 characters.(1.71+) \\ Example: "mba2019,win2019" \\ If set to auto it will have the same effect as the autoserver parameter. 
 +| *autoserver=<value> | Set the Rocrail Server auto search with R2RNet. | see USERCNF.h -> ENABLE_R2RNET | 0=off, 1=on |
 | *name=<value> | Optional node name. | - | | *name=<value> | Optional node name. | - |
 | *id=<value> | Node number/throttle ID; Should be unique. | 33 | | *id=<value> | Node number/throttle ID; Should be unique. | 33 |
Line 230: Line 241:
 | *canprot=<value> | CAN protocol | MBUS | 0=MBUS, 1=RCAN | | *canprot=<value> | CAN protocol | MBUS | 0=MBUS, 1=RCAN |
 | *dccslave=<value> | DCC role | Master | 0=Master, 1=Slave(Booster) | | *dccslave=<value> | DCC role | Master | 0=Master, 1=Slave(Booster) |
-| *trace=<value> | Trace level | 0 (volatile) | 0=Info, 1=Debug \\ Only for current session. |+| *trace=<value> | Trace level | 0 | 0=None, 2=Info, 4=Debug \\ Only for current session except for 2(Info). |
 | *ptmain=<value> | Service mode, PT, on the main H-Bridge | 0 (volatile) | 0=off, 1=on \\ Only for testing! | | *ptmain=<value> | Service mode, PT, on the main H-Bridge | 0 (volatile) | 0=off, 1=on \\ Only for testing! |
 | *pwm=<value> | PWM size for mobile motor control | - | 600=10Hz | | *pwm=<value> | PWM size for mobile motor control | - | 600=10Hz |
 +| *display=<value> | Display type: 0=96x16, 1=128x32, 2=128x64, 3=SH1106 | - | 1 |
 **Note:**  Replace <value> to meet the local WiFi environment and setup.\\ **Note:**  Replace <value> to meet the local WiFi environment and setup.\\
 **Note:**  A reset is necessary after changing the WIO Type.\\ **Note:**  A reset is necessary after changing the WIO Type.\\
Line 256: Line 268:
  
  
-====Basic Setup with WEB Browser==== +
-|  //Not activated in case of DCC WIO type.// +
-The WIO acts as a tiny Access Point to be able to connect and do the basic setup without serial monitor.\\ +
-The WIO AP name is formatted as follows: "WIO<id>.<name>" (Default: WIO33.local)\\ +
-The WIO APs are listed up and can be selected:\\ +
-{{:arduino:win10-aps.png?0x280}} {{:arduino:wio-ap.png?0x280}}\\ +
-The AP default **Password** is "12345678" which can be changed in the USERCNF.h.\\ +
-After connecting to the WIO, the basic setup can be changed with a WEB browser at URL: +
-<code> +
-http://192.168.4.1 +
-</code> +
-After **Submit** the WIO will retry automatically the WiFi and Rocrail Server connection.\\ +
-The AP will be stopped after: +
-  * a submit. +
-  * 2 minutes idle. +
- \\+
 ====OTA Updating==== ====OTA Updating====
 |  //Must be activated by WIO Dialog.//  | |  //Must be activated by WIO Dialog.//  |
Line 283: Line 280:
  \\  \\
  
 +====OTA Install from scratch====
 +  * __**[[arduino:wio-setup-en#ota_from_scratch|Install WIO by OTA from scratch]]**__
 =====RIC - Throttle===== =====RIC - Throttle=====
 | Note: RIC is no longer supported in the firmware, and is replaced by [[:arduino:wioctrl-en|WIO Control]]. | | Note: RIC is no longer supported in the firmware, and is replaced by [[:arduino:wioctrl-en|WIO Control]]. |
Line 338: Line 337:
 The LED will start blinking very fast as long the battery is not drained completely.\\ The LED will start blinking very fast as long the battery is not drained completely.\\
 ===Server discovery=== ===Server discovery===
-|  UDP Multicast drains heap space and is therefor disabled. +If the Rocrail Server has R2RNet active on multicast address 224.0.1.20, the WIO can retrieve the server name/IP to connect it to the 8051 client port automatically.\\
-<del>If the Rocrail Server has R2RNet active on multicast address 226.0.0.1, the LOLii can retrieve the server name/IP to connect it to the 8051 client port automatically.</del>\\+
  
  \\  \\
Line 345: Line 343:
   * Connects directly to the Rocrail Server Client port 8051.   * Connects directly to the Rocrail Server Client port 8051.
   * WiFi and Server connection recovery.   * WiFi and Server connection recovery.
-  * 32 digital I/O compatible with all GCA interfaces.+  * 32 digital I/O, MCP23017, compatible with all GCA interfaces.
     * Input     * Input
     * Output     * Output
     * Block     * Block
     * Pulse     * Pulse
-  * 128 LEDs compatible with WS2812 on D8. (Color type output in Rocrail.)+  * 100 LEDs compatible with WS2812 on D8. (Color type output in Rocrail.)
     * RGB color     * RGB color
     * Brightness     * Brightness
Line 365: Line 363:
   * Input events must be acknowledged within 100ms. After this timeout a resend will occur. (Max. 5 retries.)   * Input events must be acknowledged within 100ms. After this timeout a resend will occur. (Max. 5 retries.)
  
- \\+  
 +====I/O Extender PCF8574P==== 
 +Up to 4 pieces of I/O extender type PCF8574 can be used as alternative to the 2 pieces of MCP23017. 
 +  - 0x20 and 0x21 should not be available as I2C slave ID's. (No MCP23017's installed.) 
 +  - The slave ID's of the PCF8574 should start with 0x22. 
 + 
 +**Note:** //Check for the correct type to match the 0x20 base address: PCF8574P or PCF857T. (The PCF8574A type starts with base address 0x38.)//\\ 
 +\\
 ====Addressing==== ====Addressing====
 |< >| |< >|
Line 381: Line 386:
  
 ===Dual Coil Switches=== ===Dual Coil Switches===
 +| //__Disable__ the 'Accessory' and 'Single gate' options, and __select__ output type.// |
 The next address for none single gate switches is used for the turnout command.\\ The next address for none single gate switches is used for the turnout command.\\
 So if on port 1 is a dual coil switch, port 2 should not be used, and the second switch goes on port 3.\\ So if on port 1 is a dual coil switch, port 2 should not be used, and the second switch goes on port 3.\\
-Both I2C outputs must be of type 'p' Pulse.\\+Both I2C outputs are automatically used as type 'p' Pulse.\\
 Possible hardware: Possible hardware:
   * **[[:mgv76-en|GCA76]]**   * **[[:mgv76-en|GCA76]]**
Line 415: Line 421:
 The aspect values are compatible with __**[[:rocnet:rocnetnode-led-en#signal_support|RocNetNode Pi08]]**__. (WIO version 0.81+)\\ The aspect values are compatible with __**[[:rocnet:rocnetnode-led-en#signal_support|RocNetNode Pi08]]**__. (WIO version 0.81+)\\
  \\  \\
 +
 +====Signals====
 +  - WIO-ID: Bus
 +  - LED offset: Address
 +  - Port type: Output
 +  - Control type: Aspect number
 +The aspect values are compatible with __**[[:rocnet:rocnetnode-led-en#signal_support|RocNetNode Pi08]]**__. (WIO version 0.81+)\\
 + \\
 +====Charlieplexing Signal Support====
 +Only available on [[:wio:wio03-io16-de|WIOesp32 16 I/O]], [[:wio:wiopico-io16-en|WIOpico 16 I/O]], [[:wio:wiopico-en|SIOpico]]\\
 +A Rocrail signal with control aspects and port type multiplex, uses 4 pins starting with the port offset.\\
 +The refresh rate is about 250µs.\\
 +Aspect values are used from the details tab. 24bits are used, the upper 12bits are for blinking.\\
 +Example: LED 1 and 2 on and LED 2 blinking: 0x002003 -> Aspect value = 8195 \\
 +
 +A second signal on the mast can be defined in Rocrail with address + 100 to combine it with the main signal.\\
 +
 +Brightness sets brightness, only values ​​between 200-255 can be used. A value < 200 is set to 200.\\
 +Fading with dimming is not possible.\\
 +
 +^ LED Nummber for Viessmann Multiplex Signal^^^^^^^^^
 +|LED|Pin+|Pin-|1|2|3|4|Viessmann| |
 +|1|1|2|H|L| | |Vr_Ge_O|Distant signal yellow above|
 +|2|1|3|H| |L| |Hp_Rt_R|Main signal red  right|
 +|3|1|4|H| | |L|Hp_Rt_L|Main signal red  left|
 +|4|2|1|L|H| | |Vr_Gr_O|Distant signal green above|
 +|5|2|3| |H|L| |Vr_Gr_u|Distant signal green below|
 +|6|2|4| |H| |L| | |
 +|7|3|1|L| |H| |Hp_Ge|Main signal yellow|
 +|8|3|2| |L|H| |Vr_Ge_U|Distant signal yellow below|
 +|9|3|4| | |H|L| Hp_Ws_L|Main signal white left|
 +|10|4|1|L| | |H|Hp_Gr|Main signal green|
 +|11|4|2| |L| |H| | |
 +|12|4|3| | |L|H|Hp_Ws_R|Main signal white right|
 +
 +For a correct display of the main signal at red and shunting, the distant signal must be blanked. \\
 +The brightness value in the main and distant signal must be identical. \\
 +
 +Multiplex inputs from Vissmann, viewed from below on the connector. \\
 +{{:wio:viessmann-stecker.png?200|}}
 +\\
 ====Servos==== ====Servos====
-{{ :arduino:servo.jpg?200}}{{ :arduino:servo-pwm.png?200}}+{{ :arduino:servo.jpg?200}}{{ :arduino:servo-pwm.png?200}} \\
 The addressing is the same as normal outputs.\\ The addressing is the same as normal outputs.\\
-^ Control ^ Output ^ Switch ^ Range ^ +^ Control ^ Output ^ Switch ^ Signals ^ Segment Turntable ^ Range ^ 
-| WIO | IID="WIO" | IID="WIO" | - | +| WIO | IID="WIO" | IID="WIO" | IID="WIO" | IID="WIO" | - | 
-| WIO ID | Node ID (Bus) | Node ID (Bus) | 1...255 | +| WIO ID | Node ID (Bus) | Node ID (Bus) | Node ID (Bus) | Node ID (Bus) | 1...255 | 
-| Servo port | Address | Address | 1...4 | +| Servo port | Address | Address | Address | Address | 1...4 | 
-| Extra options | - | Single gate ON | - | +| Extra options | - | Single gate ON | - | - | - | 
-| Position 1 | Parameter ON | Parameter | 0...180° | +| Accessory | - | - | Details | - | 
-| Position 2 | Parameter OFF | Value | 0...180° | +| Position 1 | Parameter ON | Parameter | RED Value 0 * | - | 0...180° | 
-| Moving speed | Delay | Switch time | 1...10 | +| Position 2 | Parameter OFF | Value | GREEN Value 1 * | - | 0...180° 
-| Target | Port type "Servo" | Port type "Servo" | - |+| Position | - | - | - | Decoder Trak number | PWM 500...2500 ²
 +| Moving speed | Delay | Switch time | Dim | Step delay| 1...10 | 
 +| Target | Port type "Servo" | Port type "Servo" | Port type "Servo" | Type wioservo | - | 
 +*  Details tab, enter using the field with decimals in the Value button \\ 
 +²  Attention, too high or too low values ​​can damage the servo start with PWM 1500 = 0°. \\ 
 +The value of the servo angle must be confirmed with enter in the decimal field.
  
  \\  \\
 ====RFID==== ====RFID====
 |  //Make sure that there are no servos and LEDs connected when switching to RFID.//  | |  //Make sure that there are no servos and LEDs connected when switching to RFID.//  |
 +
 +Not possible with WIO Type I/O16, please use ID-12LA here.
  
 {{ :arduino:wio-spi-rfid.jpg?240}} {{ :arduino:wio-spi-rfid.jpg?240}}
-  - Two [[https://www.sunrom.com/p/mifare-rfid-readerwriter-1356mhz-rc522|Mifare RFID RC522]] readers are supported.+  - Two RFID RC522 readers are supported.
   - It needs 5 extra ports; Parallel Servos are not possible.   - It needs 5 extra ports; Parallel Servos are not possible.
   - Reporting addresses are 100 and 101. (In Rocrail 101 and 102.)   - Reporting addresses are 100 and 101. (In Rocrail 101 and 102.)
Line 440: Line 494:
  
  \\  \\
-^ Signal ^ D1 Mini ^ RFID RC522 ^+ 
 +^ Signal ^ D1 Mini ESP 8266 ^ RFID RC522 ^
 | Slave Select 1 | D3 | 1 (SDA) reader 1 | | Slave Select 1 | D3 | 1 (SDA) reader 1 |
 | Slave Select 2 | D0 | 1 (SDA) reader 2 | | Slave Select 2 | D0 | 1 (SDA) reader 2 |
Line 448: Line 503:
  
  \\  \\
 +====ID-12LA====
 +{{ :arduino:rfid-card-antenna.jpg?200}} {{ :arduino:id12la-pin6-led-taginrange.jpg?200}} \\
 +Optional a RFID reader from type [[http://id-innovations.com|ID-12LA]] can be connected to the RX pin for detecting tags which will be reported to Rocrail.\\
 +The tag is used as **[[:sensor-gen-en#id|Sensor ID]]** or **[[:sensor-int-en#uid-name|UID-Name]]**, **[[:can-gc4-en#rfid_notation|decimal dot formatted]]**.\\
 +The **[[:gca_rfid-en|GCA RFID]]** board can be used to mount and connect the ID-12LA.\\
 +__The serial monitor will be set to 9600bps.__\\
 +**Note 1:** This is to scan tags between the rails to let Rocrail know where the running vehicle is.\\ 
 +**Note 2:** Use selected Tags which respond rapidly.\\ \\
 +
 +
 + \\
 +
  
 ====Pins I2C==== ====Pins I2C====
Line 466: Line 533:
  
  \\  \\
-====Display SSD1306==== +====Pins S88==== 
-{{:arduino:wio-oled-128x32.jpg?0x160}}{{:cbus:display-goes.jpg?0x160}}\\+|< >| 
 +^ ESP8266 ^ ESP32 ^ PicoW ^ Usage ^ 
 +| D0 | 12 | 10 | PS | 
 +| D5 | 17 | 11 | Reset | 
 +| D6 | 26 | 12 | Clock | 
 +| D7 | 27 | 13 | Data | 
 + 
 + \\ 
 + 
 + 
 +====Display SSD1306/SH1106==== 
 +|{{:arduino:wio-oled-128x32.jpg?0x160}}|{{:arduino:f8.jpg?0x160}}
 +|  Example.  |  {f8} on a SH1106 display. 
 Two displays can be connected to the I2C of Type SSD1306 with the I2C addresses 0x3C and 0x3D.\\ Two displays can be connected to the I2C of Type SSD1306 with the I2C addresses 0x3C and 0x3D.\\
 Formatted text is compatible with [[:rocnet:rocdisplay-en#text_format|RocDisplay]].\\ Formatted text is compatible with [[:rocnet:rocdisplay-en#text_format|RocDisplay]].\\
Line 475: Line 555:
 The Bus is used for the WIO ID, and the Display number for selecting between 1 and 2. (0x3C or 0x3D)\\ The Bus is used for the WIO ID, and the Display number for selecting between 1 and 2. (0x3C or 0x3D)\\
 The Address value is not used.\\ The Address value is not used.\\
 +===Multiplexing===
 +Up to 8 display can be used with **[[:wio:wio-displaymultiplex-en|Display multiplexing]]**.\\
 ===Supported Formatting=== ===Supported Formatting===
 Formatting commands are enclose in curly brackets. Formatting commands are enclose in curly brackets.
Line 482: Line 564:
 </code> </code>
 ^ Command ^ Parameter ^ Description ^ Remark ^ ^ Command ^ Parameter ^ Description ^ Remark ^
 +| {A...} | 0...9 & : | Enlarged numbers. | Example: {A%hour%:%min%} |
 | {B#} | #=0-99999999 | Read an AMP file, "#.amp", from SPIFFS, and draw the bitmap on the current position. | | {B#} | #=0-99999999 | Read an AMP file, "#.amp", from SPIFFS, and draw the bitmap on the current position. |
-| {B'//name//'} | AMP file //name// | Read an AMP file, "//name//.amp", from SPIFFS, and draw the bitmap on the current position. | The name must be between single quotes. |+| {B'//name//'} or {B[name]} | AMP file //name// | Read an AMP file, "//name//.amp", from SPIFFS, and draw the bitmap on the current position. | The name must be between square brackets((Preferred for Rocview.)) or single quotes. |
 | {E} | - | Erase display buffer. An extra {P} is needed to erase the display. | | {E} | - | Erase display buffer. An extra {P} is needed to erase the display. |
 | {F#} | #=0-2 | Select font. 0=7x5 1=6x5w 2=6x5n | Font 5x5 is not supported because its unreadable. | | {F#} | #=0-2 | Select font. 0=7x5 1=6x5w 2=6x5n | Font 5x5 is not supported because its unreadable. |
 | {H#} | #=0-255 | Set the display contrast. | | {H#} | #=0-255 | Set the display contrast. |
 | {I#} | #=0-1 | Invert the display. 0=normal 1=inverted | | {I#} | #=0-1 | Invert the display. 0=normal 1=inverted |
-| {L#} | #=0-3 | Goto line. The range depends on the display size. |+| {L#} | #=0-3 | Goto line. The range depends on the display size. (Y = L * 8) |
 | {P} | - | Copy buffer to the display. | | {P} | - | Copy buffer to the display. |
-| {R#} | #=0,2 | Set display mapping rotation. 0=0° 2=180° |+| {R#} | #=0,2 | Set display mapping rotation. 0=0° 2=180° | See also **[[:arduino:wio-setup-en#display|Setup Display]]** |
 | {?V} | - | Show firmware version. | | {?V} | - | Show firmware version. |
 | {X#} | #=0-127 | Goto column. The range depends on the display size. | | {X#} | #=0-127 | Goto column. The range depends on the display size. |
 | {Y#} | #=0-32 | Goto row. The range depends on the display size. | | {Y#} | #=0-32 | Goto row. The range depends on the display size. |
-^ New command ^ Parameter ^ Description ^ +| {c#} | #=1-16 | Draw an analog clock with the given radius on the current position. | Only one (fast) clock per display will be updated. | 
-| {c#} | #=0-16 | Draw an analog clock with the given radius on the current position. | +| {g#} | #=0,**1**,2,3 | Set display geometry. 0=96x16, 1=128x32, 2=128x64, 3=SH1106 (1 is default)| This is for testing only. To save CPU load set the [[#monitor_commands|display]] option. \\ See also **[[:arduino:wio-setup-en#display|Setup Display]]** |
-| {g#} | #=0,**1**,2 | Set display geometry. 0=96x16, 1=128x32, 2=128x64 (1 is default)| This is for testing only. To save CPU load set the [[#monitor_commands|display]] option. |+
 | {i} | - | Toggle inverted text. | | {i} | - | Toggle inverted text. |
 | {s#} | #=1-x | Draw scrolling text on the current position, with a view width of n characters. | Example: {s12}Scrolling text to show...{s} | | {s#} | #=1-x | Draw scrolling text on the current position, with a view width of n characters. | Example: {s12}Scrolling text to show...{s} |
 | {d} | - | Scroll one text line down. | | {d} | - | Scroll one text line down. |
-| {f} | - | 7-Segment fast clock. |+| {f#} | #=1-| 7-Segment fast clock. | Only one (fast) clock per display will be updated. | 
 +| {f7} | - | User defined fast clock. \\ __Needed files:__ 0.amp...9.amp and colon.amp | Example data: {{:arduino:f7.zip}} \\ Max. file size is 1024 bytes per amp. \\ {X#} and {L#} are used for position. \\ The DISPLAY_FASTCLOCK must be set to true in the USERCNF.h | 
 +| {f8} | - | Same as {f7} but with leading hour zero if needed. | Example: 08:22 instead of 8:22|
 | {p} | - | Swap displays. | | {p} | - | Swap displays. |
 +| {l#,#} | - | Draw a line from X,Y to #,# |
 +| {r#,#} | - | Draw a rectangle left upper X,Y to right under #,# |
 +| {z#} | - | Draw a circle with center and radius # |
 +| {x#,#} | - | Draw a pixel at #,# |
 +| {+} | - | [[:arduino:wio-ampchar-en|Use large characters from file system.]] | The characters are on the file system in the amp format. Example: ''3.amp'' |
 +| {-} | - | Stop using large characters. |
 +
 **Note:** //If the geometry is not default, 128x32, the text MUST start with a {gn} command for selecting the right geometry.//\\ **Note:** //If the geometry is not default, 128x32, the text MUST start with a {gn} command for selecting the right geometry.//\\
  
Line 514: Line 605:
  
 ====DCC Generator==== ====DCC Generator====
-:!: Only supported on ESP8266 boards.\\ 
 {{ :arduino:pulseview-wio-dcc.jpg?400}} {{ :arduino:pulseview-wio-dcc.jpg?400}}
 === WIO supports following DCC packets === === WIO supports following DCC packets ===
Line 522: Line 612:
   * Accessories.   * Accessories.
   * BinState   * BinState
-  * Programming Track; Service mode. (A second H-Bridge is required: WIO-Boost-PT)+  * Programming Track; Service mode. (A second H-Bridge is required: __**[[:gca:wioprog2-en|WIO-Prog2]]**__) 
 +    - Global power must be ON 
 +    - PT must be set to ON 
 +    - Read/Write CV
   * Loco addresses >= 100 are regarded as long address.   * Loco addresses >= 100 are regarded as long address.
   * Short address 111 is used as dummy to trigger other decoders to broadcast there address.   * Short address 111 is used as dummy to trigger other decoders to broadcast there address.
Line 550: Line 643:
 The locomotive __**[[:loc-int-en#bus|Bus]]**__ value must be set to the WIO ID.\\ The locomotive __**[[:loc-int-en#bus|Bus]]**__ value must be set to the WIO ID.\\
 The number of __**[[:loc-int-en#decoder_steps|Decoder Steps]]**__ must be set in the range 50 to 100.\\ The number of __**[[:loc-int-en#decoder_steps|Decoder Steps]]**__ must be set in the range 50 to 100.\\
-===Pins=== +===Pins LOLIN D1=== 
-{{ :arduino:l620x.jpg?400}}+{{  arduino:lipo3s-measure-.png?240}}
 ^ Pin ^ Usage ^ H-Bridge ^ Remark ^ ^ Pin ^ Usage ^ H-Bridge ^ Remark ^
-| D0 | Light function | | | +| D0 | Lights front | | Cab1 | 
-| D5 | Motor PWM | Enable line | RC ESC servo PWM | +| D3 | Lights rear | | Cab2 
-| D6 | Output forwards direction | IN 1 | | +| D5 | Motor Enable | ENA | RC ESC servo PWM | 
-| D7 | Output reverse direction | IN 2 | | +| D6 | PWM forwards direction | IN1 | | 
-| I2C 1-32 | Functions 1 to 32 | | |+| D7 | PWM reverse direction | IN2 
 +| D8 | Servo PWM for coupler | | F1 
 +| I2C 1-32 | Functions 1 to 32 | | The [[:loc-fun-en#address_fx|Function address]] must be set > 0. | 
 +| A0 | Battery monitor LiPo 3S | | + 100kΩ A0 32kΩ - |
 Acceleration/deceleration can be simulated with the locomotive interface parameter __**[[:loc-int-en#mass|Mass]]**__. (10ms resolution.)\\ Acceleration/deceleration can be simulated with the locomotive interface parameter __**[[:loc-int-en#mass|Mass]]**__. (10ms resolution.)\\
 A mass value of 5 will increase/decrease the PWM 1 step at every 5*10ms.\\ A mass value of 5 will increase/decrease the PWM 1 step at every 5*10ms.\\
Line 565: Line 661:
 Note: __**Only connect ground and PWM in case the ESC supports BEC.**__\\ Note: __**Only connect ground and PWM in case the ESC supports BEC.**__\\
  \\  \\
-====ID-12LA==== 
-{{ :arduino:rfid-card-antenna.jpg?200}}{{ http://id-innovations.com/httpdocs/assets/immage/id12new.jpg}} 
-Optional a RFID reader from type [[http://id-innovations.com|ID-12LA]] can be connected to the RX pin for detecting tags which will be reported to Rocrail.\\ 
-The tag is used as **[[:sensor-gen-en#id|Sensor ID]]** or **[[:sensor-int-en#uid-name|UID-Name]]**, **[[:can-gc4-en#rfid_notation|decimal dot formatted]]**.\\ 
-The **[[:gca_rfid-en|GCA RFID]]** board can be used to mount and connect the ID-12LA.\\ 
-__The serial monitor will be set to 9600bps.__\\ 
-**Note:** This is to scan tags between the rails to let Rocrail know where the running vehicle is.\\ 
  
- \\ 
 ====RailCom==== ====RailCom====
 {{ :arduino:railcom_cutout.jpg?400}} {{ :arduino:railcom_cutout.jpg?400}}
Line 600: Line 688:
 ====Sound==== ====Sound====
 Sound can be played on ESP32 boards using one of the DAC pins. (GPIO25 or GPIO26)\\ Sound can be played on ESP32 boards using one of the DAC pins. (GPIO25 or GPIO26)\\
 +The USER_SOUND in the USERCNF.h must be set to true:
 +<code>
 +// Sound
 +#define USER_SOUND          true
 +</code>
 Supported [[ https://de.wikipedia.org/wiki/RIFF_WAVE|RIFF Wave]] format: Supported [[ https://de.wikipedia.org/wiki/RIFF_WAVE|RIFF Wave]] format:
   * PCM type   * PCM type
Line 619: Line 712:
   * Normalise the sounds files so the data uses the full 16 bit.   * Normalise the sounds files so the data uses the full 16 bit.
  
 +
 + \\
 +====StepMotor====
 +The WIO-02 supports two types of step motors: 4-wire and 3-wire step driver.\\
 +{{ :arduino:stepmotor-4wire.jpg?0x200}}{{ :arduino:stepmotor-3wire.jpg?0x200}}
 +^ WIO-02 ^ 4-wire ^ 3-wire ^ Remark ^
 +| 32 | IN1 | CLK+ |
 +| 13 | IN2 | DIR+ |
 +| 2 | IN3 | ENABLE+ |
 +| 15 | IN4 | - |
 +| 25 | -   | | Hall/Reed calibrate sensor | 
 +| EP1-1   | GND | CLK-,DIR-,ENABLE- |
 +| -       | VCC | 12V-45V DC | External power supply |
 +===Turntable Setup===
 +|  Turntable Interface  ||
 +^ Field ^ Value ^ Remark ^
 +| Node ID | WIO-02 ID | |
 +| Address | 1 | Fixed |
 +| Lights  | 1...32 | Optional bridge cabin lights. \\ Digital output port on the same WIO-02. |
 +| Decoder steps | 0-16777215 | Nr of steps for one 360° rotation. \\ In case of a 28BYJ-48: 4096 steps. |
 +| Correction | 0-255 | To compensate for the gear backlash. |
 +| Step delay | 1-10 | Size of the start and deceleration ramp |
 +| Offset | -32767...+32767 | Calibration correction point in steps. |
 +| Type | wio |
 +| rotation speed | 0-100% |
 +//The number of decoder steps for one turntable rotation is needed to calculate the shortest way.//\\
 + \\
 +|  Turntable Tracks (Example 4096 steps)  ||
 +^ Track ^ Decoder track ^
 +|  0  |  0  |
 +|  12  |  1024  |
 +|  24  |  2048  |
 +|  36  |  3072  |
 +
 +XML example: (Only mandatory attributes are listed.)
 +<code xml>
 +  <tt ori="west" id="tt1" x="11" y="4" z="0" pos="0" iid="RCAN-1" bus="102" addr="1" type="wio" decsteps="4096">
 +    <track nr="0" decnr="0"/>
 +    <track nr="12" decnr="1024"/>
 +    <track nr="24" decnr="2048"/>
 +    <track nr="36" decnr="3072"/>
 +  </tt>
 +</code>
 +
 +
 + \\
  
 ====CAN==== ====CAN====
Line 654: Line 793:
  
 ====Sensor setup==== ====Sensor setup====
-<code>Loco [ICE-CAM] reports RFID event 56:101 [4.102.181.114.9.64.128] ON</code>+<code>Loco [ICE] reports RFID event 56:101 [4.102.181.114.9.64.128] ON</code>
 The reported RFID must mach with a __**[[:sensor-gen-en#id|Sensor-ID]]**__ in Rocrail.\\ The reported RFID must mach with a __**[[:sensor-gen-en#id|Sensor-ID]]**__ in Rocrail.\\
-This sensor should have its address set to zero.\\+The sensor in Rocrail should have an address unique other than zero.\\
 The ID must be set in this notation: __**[[:can-gc4-en#rfid_notation|RFID Notation]]**__\\ The ID must be set in this notation: __**[[:can-gc4-en#rfid_notation|RFID Notation]]**__\\
 The Rocrail traces can be used to copy this ID or the __**[[:sensormon-en|Sensor Monitor]]**__.\\ The Rocrail traces can be used to copy this ID or the __**[[:sensormon-en|Sensor Monitor]]**__.\\
Line 668: Line 807:
  
  \\  \\
 +
 +=====KeyPad=====
 +{{ :wio:wio-keypad.jpg?240}}
 +A KeyPad is supported on WIO Type IO16 on I/O connector 1.
 +The # key will send the input to Rocrail es Text event. Rocrail will look up a Text object with this NodeID set on the interface tab.\\
 +With the * key the input can be corrected.\\
 +If a display is connected the input will be shown on line 3, but can be changed in the USERCNF.h. (Zero based line offset.)\\
 +Supportes KeyPads: 3x4 and 4x4. The 4x4 has "ABCD" on the extra key column.\\
 +It is recommended to set the ports 1...8 on the setup tab as follows:\\
 +{{:arduino:keypad-port-setup.jpg?240}}\\
 +
 +
 + \\
 +
 =====Hardware===== =====Hardware=====
 The firmware for IO-Type RIC does not function without pull-up resistors on the button inputs, including the rotary switch. The firmware for IO-Type RIC does not function without pull-up resistors on the button inputs, including the rotary switch.
Line 700: Line 853:
 ===Solution=== ===Solution===
 Make sure all conneted I2C modules are powered up at the same time as the WIO.\\ Make sure all conneted I2C modules are powered up at the same time as the WIO.\\
 +
 + \\
 +====macOS "Big Sur"====
 +===Upload tool ESP8266===
 +  * https://forum.arduino.cc/index.php?topic=702144.0
 +
 +===Upload tool ESP32===
 +  * https://github.com/espressif/esptool/issues/540
 +
 +
 +
 +
 + \\
 +=====Programming WIO Binary with Arduino IDE Tools=====
 +
 +|  Arduino IDE 1.8.16  |
 +
 +====macOS "Big Sur"====
 +===ESP8266===
 +<code>
 +export WIOBIN=~/Downloads/WIO.ino.d1_mini.bin
 +
 +/Users/$USER/Library/Arduino15/packages/esp8266/tools/python3/3.7.2-post1/python3 \
 +/Users/$USER/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.1/tools/upload.py \
 +--chip esp8266 --port /dev/cu.usbserial-110 --baud 921600 --before default_reset --after hard_reset write_flash 0x0 $WIOBIN
 +</code>
 +===ESP32===
 +<code>
 +~/Library/Arduino15/packages/esp32/tools/esptool_py/3.1.0/esptool \
 +--chip esp32 \
 +--port /dev/cu.usbserial-01B9FA0C \
 +--baud 921600 \
 +--before default_reset \
 +--after hard_reset write_flash \
 +-z \
 +--flash_mode dio \
 +--flash_freq 80m \
 +--flash_size 4MB \
 +0x10000 WIO.ino.d1_mini32.bin
 +</code>
 +
 +
 +====Windows 10====
 +<code>
 +set WIOBIN=\Users\%USERNAME%\Downloads\WIO.ino.d1_mini.bin
 +
 +C:\Users\%USERNAME%\AppData\Local\Arduino15\packages\esp8266\tools\python3\3.7.2-post1/python3 -I C:\Users\%USERNAME%\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2/tools/upload.py --chip esp8266 --port COM3 --baud 921600 --before default_reset --after hard_reset write_flash 0x0 %WIOBIN%
 +</code>
 +
 +====PiOS-64 "Buster"====
 +<code>
 +export WIOBIN=/home/$USER/Downloads/WIO.ino.d1_mini.bin
 +
 +/home/$USER/.arduino15/packages/esp8266/tools/python3/3.7.2-post1/python3 -I /home/$USER/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/upload.py --chip esp8266 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash 0x0 $WIOBIN 
 +</code>
 +
 +
 +
 +
arduino/wio-en.1593789239.txt.gz · Last modified: 2020/07/03 17:13 by rjversluis