arduino:wio-en
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
arduino:wio-en [2020/01/18 08:10] – [Flyer] rjversluis | arduino:wio-en [2024/04/18 11:53] (current) – [LEDs] rjversluis | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | [[: | ||
[[: | [[: | ||
- | ====== WIO - Throttle - 32 I/O - LEDs - Servos - RFID - Displays - DCC ====== | + | ====== WIO Firmware |
- | [[:english|{{ | + | [[:wio:overview-en|{{ :wio:wiologo.png}}]] |
- | [[: | + | [[: |
- | * [[: | + | * [[: |
- | \\ | + | * [[:arduino:wio-rascii-en|WIO RASCII]] | [[:arduino:wio-canprot-en|WIO CAN Protocol]] |
- | {{ :arduino:rici-proto.png? | + | * [[https:// |
- | ^ W o r k - I n - P r o g r e s s ^ | + | |
\\ | \\ | ||
=====Introduction===== | =====Introduction===== | ||
- | This solution | + | This project |
+ | 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 31: | Line 33: | ||
* Lolin D32 | * Lolin D32 | ||
* ESP32 Dev Module | * ESP32 Dev Module | ||
+ | * ESP32 D1 Mini | ||
+ | |||
+ | ====Used Pins==== | ||
+ | Check the pin mapping in Pins.cpp: | ||
+ | * https:// | ||
====Flyer==== | ====Flyer==== | ||
- | * https:// | + | * https:// |
\\ | \\ | ||
Line 48: | Line 55: | ||
\\ | \\ | ||
=====Arduino IDE===== | =====Arduino IDE===== | ||
- | //Tested with version 1.8.10//\\ | ||
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 " | + | Add in the preference dialog to " |
< | < | ||
https:// | https:// | ||
+ | https:// | ||
</ | </ | ||
+ | |||
{{ : | {{ : | ||
- | And install the ESP8266 | + | And install the ESP8266 |
====Board selection==== | ====Board selection==== | ||
{{ : | {{ : | ||
'' | '' | ||
+ | |||
====Libraries==== | ====Libraries==== | ||
- | | + | ===ESP8266 & ESP32=== |
- | * Wire (I2C) | + | |
- | * FastLED | + | * Adafruit NeoPixel |
* RotaryEncoder | * RotaryEncoder | ||
* MFRC522 (RC522) | * MFRC522 (RC522) | ||
* Servo | * Servo | ||
+ | * ArduinoOTA | ||
+ | * mcp_can | ||
+ | * https:// | ||
+ | * [[: | ||
+ | * SparkFun APDS9960 RGB and Gesture Sensor \\ Line 198 in the Arduino/ | ||
+ | |||
+ | |||
+ | ===ESP32=== | ||
+ | * ESP32 (Board Manager) | ||
+ | * ESP32Servo | ||
+ | * ESP32CAN | ||
+ | * https:// | ||
+ | |||
+ | __**ESP32CAN Modifications**__\\ | ||
+ | The '' | ||
+ | Replace '' | ||
+ | <code c> | ||
+ | int CAN_write_frame(const CAN_frame_t *p_frame) { | ||
+ | if (sem_tx_complete == NULL) { | ||
+ | return -1; | ||
+ | } | ||
+ | |||
+ | // Write the frame to the controller | ||
+ | CAN_write_frame_phy(p_frame); | ||
+ | |||
+ | // wait for the frame tx to complete | ||
+ | int rc = xSemaphoreTake(sem_tx_complete, | ||
+ | return rc; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | | Just decreas " | ||
+ | \\ | ||
- | ====SPIFFS==== | + | ====FileSystem==== |
- | Select | + | Select |
- | {{:arduino:arduino-esp8266-spiffs-2m.png?400}}\\ | + | {{: |
- | SPIFFS | + | LittleFS |
Installing the Arduino IDE Plugin for uploading data: | Installing the Arduino IDE Plugin for uploading data: | ||
* https:// | * https:// | ||
- | ====Dark Theme==== | ||
- | For those who wants a Dark Theme for the Arduino IDE: | ||
- | * https:// | ||
- | \\ | ||
=====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:// |
- | | + | * Clone the repository: (WIO with capitals!)\\ < |
- | * [[https:// | + | * [[https:// |
- | 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.\\ |
+ | |||
+ | |||
+ | __**IMPORTANT**__ | ||
+ | ^ :!::!::!: The directory MUST be renamed after unpacking the ZIP from " | ||
+ | The sources are unusable in the Arduino IDE without renaming the main source directory, and will bring only a mess of compile errors!\\ | ||
+ | \\ | ||
+ | (**Important: | ||
+ | \\ | ||
+ | \\ | ||
====Binary==== | ====Binary==== | ||
- | {{ : | + | {{ : |
Use the Espressif tool to upload the WIO Binary. | Use the Espressif tool to upload the WIO Binary. | ||
- | * [[https://launchpad.net/rocrail/+download|WIO Binary]] | + | * [[https://gitlab.com/rocrail/wio|WIO Binaries]] |
* [[https:// | * [[https:// | ||
+ | * :!: Do not uncheck " | ||
====Compile output==== | ====Compile output==== | ||
Line 107: | Line 155: | ||
- | Setting up the WiFi can be done with the Arduino Serial Monitor | + | Setting up the WiFi can be done with the Arduino Serial Monitor |
< | < | ||
# | # | ||
Line 118: | Line 166: | ||
Output after a ? command:\\ | Output after a ? command:\\ | ||
< | < | ||
- | Settings: | ||
------------------------------ | ------------------------------ | ||
- | version=0.85 WIO 20191031d | + | 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=0 |
- | 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=< | ||
- | *pwd=< | ||
- | *server=< | ||
- | *port=< | ||
- | *name=< | ||
- | *id=< | ||
- | *io=< | ||
- | *i2c=< | ||
- | *steps=< | ||
- | *pulse=< | ||
- | *display=< | ||
- | *dccsc=< | ||
- | *railcom=< | ||
- | *maxpower=< | ||
</ | </ | ||
====User Configuration==== | ====User Configuration==== | ||
- | The [[https:// | + | The [[https:// |
The values must be set before compile and upload.\\ | The values must be set before compile and upload.\\ | ||
Afterwards those values can be changed with monitor commands.\\ | Afterwards those values can be changed with monitor commands.\\ | ||
+ | :!: The values in the USERCNF.h-file are only used, if there is no configuration yet (new device).\\ | ||
+ | - If the values in the flash memory of an existing WIO-device should be replaced by those in the USERCNF.h, the option "Erase Flash" in the Arduino-IDE has to be set to "All Flash Contents" | ||
+ | - If just the firmware of an existing WIO-device should be updated, without changing the configuration (e.g. WLAN-settings), | ||
====Monitor commands==== | ====Monitor commands==== | ||
- | The Arduino Serial Monitor can be use with 57600 bps to change WIO settings.\\ | + | The Arduino Serial Monitor can be use with 115200 |
- | //(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. | ||
+ | |||
+ | Basic connection setup can also be done on the __**[[: | ||
- | ^ Command ^ Description ^ Default ^ | + | ^ Command ^ Description ^ Default |
| ? | 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=< | + | | *sod | Force Start of Day | |
- | | *pwd=< | + | | *scan | List all available WiFi APs | |
- | | *server=< | + | | *ssid1=< |
- | | *port=< | + | | *pwd1=< |
+ | | *ssid2=< | ||
+ | | *pwd2=< | ||
+ | | *server=< | ||
+ | | *autoserver=< | ||
| *name=< | | *name=< | ||
| *id=< | | *id=< | ||
Line 183: | Line 239: | ||
| *steps=< | | *steps=< | ||
| *pulse=< | | *pulse=< | ||
- | | *display=< | + | | *canprot=< |
- | | *dccsc=< | + | | *dccslave=< |
- | | *railcom=< | + | | *trace=< |
- | | *maxpower=< | + | | *ptmain=< |
+ | | *pwm=< | ||
+ | | *display=< | ||
**Note: | **Note: | ||
**Note: | **Note: | ||
Line 210: | 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: " | + | |
- | The WIO APs are listed up and can be selected: | + | |
- | {{: | + | |
- | The AP default **Password** is " | + | |
- | After connecting to the WIO, the basic setup can be changed with a WEB browser at URL: | + | |
- | < | + | |
- | http:// | + | |
- | </ | + | |
- | 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 231: | Line 274: | ||
{{: | {{: | ||
Just select the desired WIO from the list instead of the USB port, and upload.\\ | Just select the desired WIO from the list instead of the USB port, and upload.\\ | ||
- | If asked for a **Password**, | + | If asked for a **Password**, |
{{: | {{: | ||
Line 237: | Line 280: | ||
\\ | \\ | ||
+ | ====OTA Install from scratch==== | ||
+ | * __**[[arduino: | ||
=====RIC - Throttle===== | =====RIC - Throttle===== | ||
+ | | Note: RIC is no longer supported in the firmware, and is replaced by [[: | ||
**Note:** //RIC controls locos by address, not by ID. So the first one in the list will be used if multiple locos share the same address.// | **Note:** //RIC controls locos by address, not by ID. So the first one in the list will be used if multiple locos share the same address.// | ||
The pocket throttle I/O mode needs a rotary switch, one LED and four buttons.\\ | The pocket throttle I/O mode needs a rotary switch, one LED and four buttons.\\ | ||
Line 291: | 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 |
- | <del>If the Rocrail Server has R2RNet active on multicast address | + | |
\\ | \\ | ||
Line 298: | 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, |
* 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 318: | 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' | ||
+ | - 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==== | ||
|< >| | |< >| | ||
^ Rocrail ^ WIO ^ | ^ Rocrail ^ WIO ^ | ||
| Interface ID | " | | Interface ID | " | ||
- | | Bus | ID | | + | | Node ID (Bus) | ID | |
| Address | I2C Port | | | Address | I2C Port | | ||
| Address | LED Port | | | Address | LED Port | | ||
Line 332: | Line 384: | ||
* Signals | * Signals | ||
* Sensors | * Sensors | ||
+ | |||
+ | ===Dual Coil Switches=== | ||
+ | | // | ||
+ | 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.\\ | ||
+ | Both I2C outputs are automatically used as type ' | ||
+ | Possible hardware: | ||
+ | * **[[: | ||
+ | * [[: | ||
+ | * [[: | ||
====Blink==== | ====Blink==== | ||
Line 338: | Line 400: | ||
\\ | \\ | ||
====LEDs==== | ====LEDs==== | ||
+ | //" | ||
{{ : | {{ : | ||
The addressing is the same as normal outputs.\\ | The addressing is the same as normal outputs.\\ | ||
+ | |||
+ | **Dimming information: | ||
+ | //WIO version 875+//\\ | ||
+ | The dimming frequentation depends of Controller Steps and Output/ | ||
+ | The brightness is divided by the number of steps, and multiplied by the delay value which is subtracted/ | ||
+ | A low step and high delay value will cause fastest dimming.\\ | ||
===Outputs=== | ===Outputs=== | ||
Line 359: | Line 428: | ||
The aspect values are compatible with __**[[: | The aspect values are compatible with __**[[: | ||
\\ | \\ | ||
+ | |||
+ | ====Signals==== | ||
+ | - WIO-ID: Bus | ||
+ | - LED offset: Address | ||
+ | - Port type: Output | ||
+ | - Control type: Aspect number | ||
+ | The aspect values are compatible with __**[[: | ||
+ | \\ | ||
+ | ====Charlieplexing Signal Support==== | ||
+ | Only available on [[: | ||
+ | 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. \\ | ||
+ | {{: | ||
+ | \\ | ||
====Servos==== | ====Servos==== | ||
- | {{ : | + | {{ : |
The addressing is the same as normal outputs.\\ | The addressing is the same as normal outputs.\\ | ||
- | ^ Control ^ Output ^ Switch ^ Range ^ | + | ^ Control ^ Output ^ Switch |
- | | WIO | IID=" | + | | WIO | IID=" |
- | | WIO ID | Bus | 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 |
- | | Extra options | - | Single gate | - | | + | | 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 |
- | | Moving speed | Delay | Switch time | 1...10 | | + | | Position 2 | Parameter OFF | Value | GREEN Value 1 * | - | 0...180° |
- | | Target | Port type " | + | | Position | - | - | - | Decoder Trak number | PWM 500...2500 ²| |
+ | | Moving speed | Delay | Switch time | Dim | Step delay| 1...10 | | ||
+ | | Target | Port type " | ||
+ | * 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. | ||
{{ : | {{ : | ||
- | - Two [[https:// | + | - 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 384: | Line 501: | ||
\\ | \\ | ||
- | ^ 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 392: | Line 510: | ||
\\ | \\ | ||
+ | ====ID-12LA==== | ||
+ | {{ : | ||
+ | Optional a RFID reader from type [[http:// | ||
+ | The tag is used as **[[: | ||
+ | The **[[: | ||
+ | __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 410: | Line 540: | ||
\\ | \\ | ||
- | ====Display SSD1306==== | + | ====Pins S88==== |
- | {{: | + | |< >| |
+ | ^ ESP8266 ^ ESP32 ^ PicoW ^ Usage ^ | ||
+ | | D0 | 12 | 10 | PS | | ||
+ | | D5 | 17 | 11 | Reset | | ||
+ | | D6 | 26 | 12 | Clock | | ||
+ | | D7 | 27 | 13 | Data | | ||
+ | |||
+ | \\ | ||
+ | |||
+ | |||
+ | ====Display SSD1306/SH1106==== | ||
+ | |{{: | ||
+ | | Example. | ||
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 [[: | Formatted text is compatible with [[: | ||
Line 419: | Line 562: | ||
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 **[[: | ||
===Supported Formatting=== | ===Supported Formatting=== | ||
Formatting commands are enclose in curly brackets. | Formatting commands are enclose in curly brackets. | ||
Line 426: | Line 571: | ||
</ | </ | ||
^ Command ^ Parameter ^ Description ^ Remark ^ | ^ Command ^ Parameter ^ Description ^ Remark ^ | ||
+ | | {A...} | 0...9 & : | Enlarged numbers. | Example: {A%hour%: | ||
| {B#} | # | | {B#} | # | ||
- | | {B'// | + | | {B'// |
| {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° |
| {?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 |
- | | {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 [[# | + | |
| {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-2 | 7-Segment fast clock. |
+ | | {f7} | - | User defined fast clock. \\ __Needed files:__ 0.amp...9.amp and colon.amp | Example data: {{: | ||
+ | | {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 #,# | | ||
+ | | {+} | - | [[: | ||
+ | | {-} | - | 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.// | ||
+ | \\ | ||
+ | ====7-Segment Display HT16K33 ==== | ||
+ | {{ : | ||
+ | //Fast Clock//\\ | ||
+ | The Adafruit breakout board HT16K33 is supported on I2C address 0x70.\\ | ||
+ | It displays alternate time, date and temperature.\\ | ||
+ | With the '' | ||
\\ | \\ | ||
Line 454: | Line 615: | ||
=== WIO supports following DCC packets === | === WIO supports following DCC packets === | ||
* Loco speed and direction. (No support for 14 speed steps.) | * Loco speed and direction. (No support for 14 speed steps.) | ||
- | * Loco functions 0-28. | + | * Loco functions 0-32. |
- | * POM set/get. (A RailCom detector is needed for POM get.) | + | * PoM set/get. (A RailCom detector, GCA214, |
* Accessories. | * Accessories. | ||
* BinState | * BinState | ||
+ | * Programming Track; Service mode. (A second H-Bridge is required: __**[[: | ||
+ | - 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 463: | Line 628: | ||
* 100% NMRA timing conform. | * 100% NMRA timing conform. | ||
* Automatically Power OFF after a Rocrail Server connection loss. | * Automatically Power OFF after a Rocrail Server connection loss. | ||
- | * Shows activity on a display if a one is connected. | + | * Shows activity on a display if one connected. |
* 48 slot refresh stack with auto purging. | * 48 slot refresh stack with auto purging. | ||
* 12 accessory command queue. | * 12 accessory command queue. | ||
Line 469: | Line 634: | ||
^ Pin ^ Usage ^ Remark ^ | ^ Pin ^ Usage ^ Remark ^ | ||
| D6 & D7 | DCC symmetric signal. | | | | D6 & D7 | DCC symmetric signal. | | | ||
- | | D5 | Enable H-Bridge | | | + | | D5 | Enable H-Bridge |
+ | | D8 | Enable H-Bridge 2 | Service | ||
===ORD3=== | ===ORD3=== | ||
- | To use the 3.3V level a 470 Ohm resistor must be add parallel to R1.\\ | + | To use the 3.3V level a 470 Ohm resistor must be added parallel to R1.\\ |
===Mobile Addressing=== | ===Mobile Addressing=== | ||
^ IID | WIO | Remark | | ^ IID | WIO | Remark | | ||
- | ^ Bus | WIO ID | | + | ^ Node ID (Bus) | WIO ID | |
^ Address | DCC decoder address. | Addresses > 99 are regarded as long DCC address. | | ^ Address | DCC decoder address. | Addresses > 99 are regarded as long DCC address. | | ||
^ Speed steps | 28 or 128 | | | ^ Speed steps | 28 or 128 | | | ||
Line 483: | Line 649: | ||
Use the WIO as mobile decoder.\\ | Use the WIO as mobile decoder.\\ | ||
The locomotive __**[[: | The locomotive __**[[: | ||
- | The number of __**[[: | + | The number of __**[[: |
- | ===Pins=== | + | ===Pins |
- | {{ :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 | + | | D3 | Lights rear | | Cab2 | |
- | | D6 | Output | + | | D5 | Motor Enable |
- | | D7 | Output | + | | 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 [[: | ||
+ | | A0 | Battery monitor LiPo 3S | | + 100kΩ A0 32kΩ - | | ||
Acceleration/ | Acceleration/ | ||
A mass value of 5 will increase/ | A mass value of 5 will increase/ | ||
Line 499: | Line 668: | ||
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==== | ||
- | {{ : | ||
- | Optional a RFID reader from type [[http:// | ||
- | The tag is used as **[[: | ||
- | The **[[: | ||
- | __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==== | ||
{{ : | {{ : | ||
The serial connector on the WIO PCB can be used to connect it to an amplifier for reading RailCom data.\\ | The serial connector on the WIO PCB can be used to connect it to an amplifier for reading RailCom data.\\ | ||
- | At the moment there is no such board in the GCA line. For testing the GCA204 | + | The GCA214 |
The following RailCom IDs are supported: | The following RailCom IDs are supported: | ||
^ ID ^ Channel ^ Description ^ | ^ ID ^ Channel ^ Description ^ | ||
Line 521: | Line 682: | ||
\\ | \\ | ||
- | ====Sensor==== | + | ====Sensors==== |
- | {{ : | + | {{ : |
- | One BMx280 | + | One BME280/ |
The USER_ALTITUDE in the USERCNF.h must be adjusted to meet the local altitude for correct pressure values.\\ | The USER_ALTITUDE in the USERCNF.h must be adjusted to meet the local altitude for correct pressure values.\\ | ||
+ | One TSL2591 ' | ||
===Dynamic Text=== | ===Dynamic Text=== | ||
Temperature, | Temperature, | ||
Line 533: | Line 695: | ||
====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: | ||
+ | < | ||
+ | // Sound | ||
+ | #define USER_SOUND | ||
+ | </ | ||
Supported [[ https:// | Supported [[ https:// | ||
* PCM type | * PCM type | ||
Line 551: | Line 718: | ||
To get the best result: | To get the best result: | ||
* 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.\\ | ||
+ | {{ : | ||
+ | ^ 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-, | ||
+ | | - | VCC | 12V-45V DC | External power supply | | ||
+ | ===Turntable Setup=== | ||
+ | | Turntable Interface | ||
+ | ^ Field ^ Value ^ Remark ^ | ||
+ | | Node ID | WIO-02 ID | | | ||
+ | | Address | 1 | Fixed | | ||
+ | | Lights | ||
+ | | 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=" | ||
+ | <track nr=" | ||
+ | <track nr=" | ||
+ | <track nr=" | ||
+ | <track nr=" | ||
+ | </tt> | ||
+ | </ | ||
+ | |||
+ | === Output-Setup === | ||
+ | |||
+ | |< >| | ||
+ | | Interface | | ||
+ | ^ Field ^ Value ^ Remark ^ | ||
+ | | Node ID | WIO ID | | | ||
+ | | Adress | 1 | //fix// | | ||
+ | | Parameter on | 0-16777215 | Number of steps counterclockwise | | ||
+ | | Parameter off | 0-16777215 | Number of steps clockwise | | ||
+ | | Delay | 0-255 | rotation speed \\ If the value is >0, an acceleration and braking ramp is generated. | | ||
+ | | Type | Motor | | ||
+ | |||
+ | Calibration is not possible! | ||
+ | |||
+ | |||
+ | ====CAN==== | ||
+ | {{ : | ||
+ | The WIO CAN type can be used as CAN-WiFi bridge for | ||
+ | * [[: | ||
+ | * RCAN, type TCP+binary on port 5550 | ||
+ | ====MCP2515==== | ||
+ | Pin mapping for using the SPI MCP2515(16MHz) on the __**[[: | ||
+ | |||
+ | ^ Name ^ Nano ^ Lolin D1 Mini ^ Lolin D32 ^ Remark ^ | ||
+ | | GND | GND | GND | GND | Ground | | ||
+ | | 5V | 5V | 5V | 5V(USB) | | | ||
+ | | CS | D10 | D3 | GPIO14 | Chip Select | | ||
+ | | MOSI | D11 | D7 | GPIO23(MOSI) | Master Output, Slave Input | | ||
+ | | MISO | D12 | D6 | GPIO19(MISO) | Master Input, Slave Output | | ||
+ | | SCK | D13 | D5 | GPIO18(SCK) | Serial Clock | | ||
+ | |||
+ | The Lolin D1 must be connected to 5V USB without power supply from the CAN bus.\\ | ||
+ | A WIO-CAN kit will become available.\\ | ||
+ | |||
+ | \\ | ||
+ | ====ESP32==== | ||
+ | The current WIO firmware, 1.94, does use the internal CAN controller, and uses therefor only the MCP2551/ | ||
+ | In case of ESP32 the CAN communication is always activated, independent of wich WIO type is selected.\\ | ||
+ | |< >|< >|< >| | ||
+ | ^ Connection ^ ESP32 Pin ^ MCP2561 ^ | ||
+ | | TXCAN | 16 | 1 | | ||
+ | | RXCAN | 4 | 4 | | ||
+ | |||
\\ | \\ | ||
=====Mobile RFID reader===== | =====Mobile RFID reader===== | ||
Line 557: | Line 812: | ||
====Sensor setup==== | ====Sensor setup==== | ||
- | < | + | < |
The reported RFID must mach with a __**[[: | The reported RFID must mach with a __**[[: | ||
- | This sensor should have its address | + | The sensor |
The ID must be set in this notation: __**[[: | The ID must be set in this notation: __**[[: | ||
The Rocrail traces can be used to copy this ID or the __**[[: | The Rocrail traces can be used to copy this ID or the __**[[: | ||
Line 571: | Line 826: | ||
\\ | \\ | ||
+ | |||
+ | =====KeyPad===== | ||
+ | {{ : | ||
+ | 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 " | ||
+ | It is recommended to set the ports 1...8 on the setup tab as follows:\\ | ||
+ | {{: | ||
+ | |||
+ | |||
+ | \\ | ||
+ | |||
=====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 585: | Line 854: | ||
\\ | \\ | ||
=====Trouble Shooting===== | =====Trouble Shooting===== | ||
- | ====Clear the flash==== | + | ====LOLIN vs Wemos==== |
- | //During development the setup structures can change | + | |< >| |
- | * Write another MAGIC number | + | | Top || Bottom |
- | * This will force a flash reset of the first 4k at the next reboot. | + | | LOLIN D1 mini | Wemos mini | LOLIN D1 mini | Wemos mini | |
+ | | {{: | ||
+ | |||
+ | |< >| | ||
+ | ^ Pin ^ Lolin ^ Wemos ^ | ||
+ | | D3 | - | Won't boot in case low. | | ||
+ | |||
+ | |||
+ | \\ | ||
+ | ====Very slow==== | ||
+ | If an I2C module, like the Pi02 or Pi03, is connected | ||
+ | The P82B715 I2C-bus extender seems to drain the I2C clock and data lines, which will confuse the ISR in the Wire library.\\ | ||
+ | The Pi08, with the PCA9622 chip, does not suffer this problem with its internal I2C-bus extender.\\ | ||
+ | ===Solution=== | ||
+ | Make sure all conneted I2C modules are powered up at the same time as the WIO.\\ | ||
+ | |||
+ | \\ | ||
+ | ====macOS "Big Sur" | ||
+ | ===Upload tool ESP8266=== | ||
+ | * https:// | ||
+ | |||
+ | ===Upload tool ESP32=== | ||
+ | * https:// | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | \\ | ||
+ | =====Programming WIO Binary with Arduino IDE Tools===== | ||
+ | |||
+ | | Arduino IDE 1.8.16 | ||
+ | |||
+ | ====macOS "Big Sur" | ||
+ | ===ESP8266=== | ||
+ | < | ||
+ | export WIOBIN=~/ | ||
+ | |||
+ | / | ||
+ | / | ||
+ | --chip esp8266 --port / | ||
+ | </ | ||
+ | ===ESP32=== | ||
+ | < | ||
+ | ~/ | ||
+ | --chip esp32 \ | ||
+ | --port / | ||
+ | --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 | ||
+ | </ | ||
+ | |||
+ | |||
+ | ====Windows 10==== | ||
+ | < | ||
+ | set WIOBIN=\Users\%USERNAME%\Downloads\WIO.ino.d1_mini.bin | ||
+ | |||
+ | C: | ||
+ | </ | ||
+ | |||
+ | ====PiOS-64 " | ||
+ | < | ||
+ | export WIOBIN=/ | ||
+ | |||
+ | / | ||
+ | </ | ||
+ | |||
+ | |||
+ |
arduino/wio-en.1579331417.txt.gz · Last modified: 2020/01/18 08:10 by rjversluis