arduino:wio-en
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
arduino:wio-en [2019/11/10 14:01] – [Attention] rjversluis | arduino:wio-en [2020/11/25 07:37] – [Very slow] rjversluis | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | [[: |
+ | ====== | ||
[[: | [[: | ||
[[: | [[: | ||
- | | + | * [[: |
- | \\ | + | |
- | {{ :arduino:rici-proto.png? | + | |
- | ^ W o r k - I n - P r o g r e s s ^ | + | |
\\ | \\ | ||
=====Introduction===== | =====Introduction===== | ||
- | This solution is based on the LOLIN D1 Mini. (ESP8266)\\ | + | This solution is based on the ESP8266/ESP32 family.\\ |
It can be used as: | It can be used as: | ||
* Wireless Throttle | * Wireless Throttle | ||
- | or as wireless I/O with one of the following four options: | + | or as wireless I/O with: |
- | * 32 I/O | + | * 32 I2C I/O [[: |
- | * 2 Displays | + | * 2 Displays |
- | - LED control WS2812 | + | and one of the following extra functions: |
- | - 4 Servos | + | |
- | - 2 RC522 readers | + | - 4 Servos |
- | - DCC Generator | + | - 2 RC522 readers |
+ | - DCC Generator | ||
+ | - Mobile PWM, direction and lights | ||
+ | and one of the following options: | ||
+ | * ID12LA 125kHz RFID reader on RX | ||
+ | * RailCom reader on RX | ||
+ | |||
+ | ====Supported Boards==== | ||
+ | * Lolin D1 Mini | ||
+ | * Lolin D32 | ||
+ | * ESP32 Dev Module | ||
+ | * ESP32 CAM Module | ||
+ | |||
+ | ====Used ESP Pins==== | ||
+ | Check the pin mapping in Pins.cpp: | ||
+ | * https:// | ||
====Flyer==== | ====Flyer==== | ||
- | * https:// | + | * https:// |
\\ | \\ | ||
=====Attention===== | =====Attention===== | ||
- | | + | {{ : |
- | - The used WiFi Router/ | + | |
+ | - __The used WiFi Router should be state of the art; Only use maintained hardware.__ | ||
- Make sure the SSID is not visible to prevent extra public traffic. | - Make sure the SSID is not visible to prevent extra public traffic. | ||
Line 34: | Line 50: | ||
\\ | \\ | ||
- | =====Arduino IDE===== | + | =====Arduino IDE 1.8.12===== |
- | //Tested with version | + | :!: 1.8.11 does not work! Event the BasicOTA example will not compile...\\ |
+ | * https:// | ||
Prepare the Arduino IDE with the following boards and libraries: | Prepare the Arduino IDE with the following boards and libraries: | ||
====Board manager===== | ====Board manager===== | ||
Add in the preference dialog to " | Add in the preference dialog to " | ||
< | < | ||
- | https:// | + | https:// |
</ | </ | ||
{{ : | {{ : | ||
Line 47: | Line 64: | ||
{{ : | {{ : | ||
'' | '' | ||
+ | |||
====Libraries==== | ====Libraries==== | ||
- | | + | ===ESP8266 & ESP32=== |
+ | | ||
* Wire (I2C) | * Wire (I2C) | ||
* FastLED (WS2812) | * FastLED (WS2812) | ||
Line 54: | Line 73: | ||
* MFRC522 (RC522) | * MFRC522 (RC522) | ||
* Servo | * Servo | ||
+ | * ArduinoOTA | ||
+ | * MCP_CAN | ||
+ | * https:// | ||
+ | * [[: | ||
+ | * NTPClient | ||
+ | ===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==== | ||
+ | Select 2M SPIFFS size:\\ | ||
+ | {{: | ||
+ | SPIFFS is a file system which can be used in WIO for uploading user bitmaps.\\ | ||
+ | Installing the Arduino IDE Plugin for uploading data: | ||
+ | * https:// | ||
====Dark Theme==== | ====Dark Theme==== | ||
Line 61: | Line 118: | ||
\\ | \\ | ||
=====WIO Sketch===== | =====WIO Sketch===== | ||
- | | //Copyright (c) 2002-2019 Robert Jan Versluis, Rocrail.net// | + | | //Copyright (c) 2002-2020 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:// | + | * https:// |
- | * [[https:// | + | * [[https:// |
- | * [[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.\\ | ||
+ | |||
+ | :!: **Note:** After unpacking the ZIP the folder should be renamed before loading it into the Arduino IDE from " | ||
====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/ |
* [[https:// | * [[https:// | ||
+ | * :!: Do not uncheck " | ||
====Compile output==== | ====Compile output==== | ||
Line 87: | Line 147: | ||
- | 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 98: | Line 158: | ||
Output after a ? command:\\ | Output after a ? command:\\ | ||
< | < | ||
+ | ------------------------------ | ||
+ | revision=261 WIO 20200812a (c)Rocrail | ||
+ | ------------------------------ | ||
Settings: | Settings: | ||
------------------------------ | ------------------------------ | ||
- | version=0.85 WIO 20191031d (c)Rocrail | + | ssid1= |
- | ssid=xxxxxxxx | + | pwd1= |
- | pwd=xxxxxxxx | + | ssid2= |
- | server=xxxxxxxx | + | pwd2= |
+ | server= | ||
port=8051 | port=8051 | ||
- | name= | + | name=[wio104] |
- | id=33 | + | id=104 |
- | io=i2cdcc | + | io=i2cdcc |
- | i2c=ooooooooooooooooppppiiiibbbbbbbb | + | iostate=00 00 00 00 |
- | steps=50 | + | i2c=oooooooobbbbbbbboooooooobbbbbbbb |
- | pulse=50 | + | steps=64 |
- | display=22 | + | sleeptimer=5 |
- | dccsc=0 | + | pulse=5 |
- | RSSI=-53 | + | pwmsize=0 |
- | MCP23017 status: 0x20=OK 0x21=OK | + | options=0x00 0x01 0x18 |
- | I2C device found at address 0x20 | + | booster=0 |
- | I2C device found at address 0x21 | + | board=1 |
- | I2C device found at address 0x3C | + | display=0 |
- | I2C found 3 devices | + | railcom=0 |
- | loco1=0 loco2=3 active=0 | + | id12=0 |
+ | depart=0 | ||
+ | stepper=0 3w=0 | ||
+ | canprot=1(1) | ||
+ | canio=1 | ||
+ | canusb=0 | ||
+ | trace=0 | ||
+ | SPIFFS total=1345kb used=0kb | ||
Change settings by typing: | Change settings by typing: | ||
Line 129: | Line 200: | ||
*name=< | *name=< | ||
*id=< | *id=< | ||
- | *io=< | + | *io=< |
*i2c=< | *i2c=< | ||
*steps=< | *steps=< | ||
*pulse=< | *pulse=< | ||
- | *display=<geometry1><geometry2> 0=96x16 1=128x32 2=128x64 | + | *pwm=<mobile PWM size multiplier> |
- | *dccsc=<short circuit detection> 0=off 1=on | + | *boost=<booster option for i2cdcc type> 0=off 1=on (reboot) |
+ | *dccslave=< | ||
+ | *board=< | ||
+ | *display=< | ||
+ | *trace=<level> 0=info 1=debug 9=none | ||
+ | *canprot=< | ||
+ | *canio=< | ||
</ | </ | ||
====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==== | ||
- | ^ Command ^ Description ^ Default ^ | + | The Arduino Serial Monitor can be use with 115200 bps to change WIO settings.\\ |
+ | - 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. | ||
+ | |||
+ | ^ 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=< | + | | *ssid=< |
- | | *pwd=< | + | | *pwd=< |
- | | *server=< | + | | *ssid2=< |
+ | | *pwd2=< | ||
+ | | *server=< | ||
| *port=< | | *port=< | ||
| *name=< | | *name=< | ||
| *id=< | | *id=< | ||
- | | *io=< | + | | *io=< |
| *i2c=< | | *i2c=< | ||
| *steps=< | | *steps=< | ||
| *pulse=< | | *pulse=< | ||
- | | *display=< | + | | *canprot=< |
+ | | *dccslave=< | ||
+ | | *trace=< | ||
+ | | *ptmain=< | ||
+ | | *pwm=< | ||
+ | | *display=< | ||
**Note: | **Note: | ||
+ | **Note: | ||
|< >| | |< >| | ||
Line 177: | Line 270: | ||
\\ | \\ | ||
+ | |||
+ | |||
+ | ====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==== | ||
+ | | //Must be activated by WIO Dialog.// | ||
+ | If it's not possible, or cumbersome, to update by USB, the WIO can also be updated "Over The Air" (OTA).\\ | ||
+ | {{: | ||
+ | Just select the desired WIO from the list instead of the USB port, and upload.\\ | ||
+ | If asked for a **Password**, | ||
+ | {{: | ||
+ | |||
+ | |||
+ | \\ | ||
+ | |||
=====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 243: | Line 366: | ||
* 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 255: | Line 378: | ||
* Up to 255 units in the same WiFi network. (Depending on the IP configuration and availability.) | * Up to 255 units in the same WiFi network. (Depending on the IP configuration and availability.) | ||
* An alarm will be generated if 'a live' messages are no longer come in. | * An alarm will be generated if 'a live' messages are no longer come in. | ||
- | * Output/ | + | * Output/ |
* 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.) | ||
Line 263: | Line 386: | ||
^ Rocrail ^ WIO ^ | ^ Rocrail ^ WIO ^ | ||
| Interface ID | " | | Interface ID | " | ||
- | | Bus | ID | | + | | Node ID (Bus) | ID | |
- | | Address | I2C or I/O Port | | + | | Address | I2C Port | |
| Address | LED Port | | | Address | LED Port | | ||
| Address | Servo Port | | | Address | Servo Port | | ||
Line 273: | Line 396: | ||
* 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 must be of type ' | ||
+ | Possible hardware: | ||
+ | * **[[: | ||
+ | * [[: | ||
+ | * [[: | ||
+ | |||
+ | ====Blink==== | ||
+ | The output blink and delay options can be used to blink an I2C port.\\ | ||
+ | If the delay is zero the default pulse length will be used.\\ | ||
\\ | \\ | ||
====LEDs==== | ====LEDs==== | ||
+ | {{ : | ||
The addressing is the same as normal outputs.\\ | The addressing is the same as normal outputs.\\ | ||
Line 296: | Line 433: | ||
\\ | \\ | ||
====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 ^ Range ^ | ||
| WIO | IID=" | | WIO | IID=" | ||
- | | WIO ID | Bus | Bus | 1...255 | | + | | WIO ID | Node ID (Bus) | Node ID (Bus) | 1...255 | |
| Servo port | Address | Address | 1...4 | | | Servo port | Address | Address | 1...4 | | ||
- | | Extra options | - | Single gate | - | | + | | Extra options | - | Single gate ON | - | |
| Position 1 | Parameter ON | Parameter | 0...180° | | | Position 1 | Parameter ON | Parameter | 0...180° | | ||
| Position 2 | Parameter OFF | Value | 0...180° | | | Position 2 | Parameter OFF | Value | 0...180° | | ||
Line 345: | Line 483: | ||
\\ | \\ | ||
- | ====Display SSD1306==== | + | ====Display SSD1306/SH1106==== |
{{: | {{: | ||
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.\\ | ||
Line 361: | Line 499: | ||
</ | </ | ||
^ Command ^ Parameter ^ Description ^ Remark ^ | ^ Command ^ Parameter ^ Description ^ Remark ^ | ||
- | | {Bn} | n=0-19 | Draw a bitmap on the current position. | | + | | {B#} | #=0-99999999 |
+ | | {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. | | ||
- | | {Fn} | n=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. | |
- | | {Hn} | n=0-255 | Set the display contrast. | | + | | {H#} | #=0-255 | Set the display contrast. | |
- | | {In} | n=0-1 | Invert the display. 0=normal 1=inverted | | + | | {I#} | #=0-1 | Invert the display. 0=normal 1=inverted | |
- | | {Ln} | n=0-3 | Goto line. The range depends on the display size. | | + | | {L#} | #=0-3 | Goto line. The range depends on the display size. | |
| {P} | - | Copy buffer to the display. | | | {P} | - | Copy buffer to the display. | | ||
- | | {Rn} | n=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. | | ||
- | | {Xn} | n=0-127 | Goto column. The range depends on the display size. | | + | | {X#} | #=0-127 | Goto column. The range depends on the display size. | |
- | | {Yn} | n=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 ^ | ^ New command ^ Parameter ^ Description ^ | ||
- | | {cn} | n=0-16 | Draw an analog clock with the given radius on the current position. | | + | | {c#} | #=0-16 | Draw an analog clock with the given radius on the current position. | |
- | | {gn} | n=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 [[# | + | | {g#} | #=0,**1**,2,3 | Set display geometry. 0=96x16, 1=128x32, 2=128x64, 3=SH1106 |
| {i} | - | Toggle inverted text. | | | {i} | - | Toggle inverted text. | | ||
- | | {sn} | n=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} | - | 7-Segment fast clock. | | ||
+ | | {p} | - | Swap displays. | | ||
**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.// | ||
- | ==Bitmaps== | + | \\ |
- | The bitmaps are sized 20 x 8 pixel. | + | ====7-Segment Display HT16K33 |
- | ^ Number ^ Description ^ Original ^ | + | {{ :arduino:adafruit-ht16k33.jpg?200}} |
- | | 13 | Nederlandse Spoorwegen (NS) | {{:arduino:bitmaps:ns.jpg}} | + | //Fast Clock//\\ |
+ | The Adafruit breakout board HT16K33 is supported on I2C address 0x70.\\ | ||
+ | It displays alternate time, date and temperature.\\ | ||
+ | With the '' | ||
\\ | \\ | ||
Line 391: | Line 534: | ||
=== 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: WIO-Boost-PT) | ||
+ | * Loco addresses >= 100 are regarded as long address. | ||
+ | * Short address 111 is used as dummy to trigger other decoders to broadcast there address. | ||
===Features=== | ===Features=== | ||
* 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. |
- | * 64 slot refresh stack with auto purging. | + | * 48 slot refresh stack with auto purging. |
- | * 16 accessory command queue. | + | * 12 accessory command queue. |
===Pins DCC=== | ===Pins DCC=== | ||
^ Pin ^ Usage ^ Remark ^ | ^ Pin ^ Usage ^ Remark ^ | ||
| D6 & D7 | DCC symmetric signal. | | | | D6 & D7 | DCC symmetric signal. | | | ||
- | | D5 | Short circuit detection. | + | | D5 | Enable H-Bridge 1 | Operation | |
+ | | 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 | | | ||
+ | \\ | ||
+ | ====Mobile==== | ||
+ | Use the WIO as mobile decoder.\\ | ||
+ | The locomotive __**[[: | ||
+ | The number of __**[[: | ||
+ | ===Pins LOLIN D1=== | ||
+ | {{ arduino: | ||
+ | ^ Pin ^ Usage ^ H-Bridge ^ Remark ^ | ||
+ | | D0 | Lights front | | Cab1 | | ||
+ | | D3 | Lights rear | | Cab2 | | ||
+ | | D5 | Motor Enable | ENA | RC ESC servo PWM | | ||
+ | | D6 | PWM forwards direction | IN1 | | | ||
+ | | D7 | PWM reverse direction | IN2 | | | ||
+ | | D8 | Servo PWM for coupler | | F1 | | ||
+ | | I2C 1-32 | Functions 1 to 32 | | | | ||
+ | | A0 | Battery monitor LiPo 3S | | + 100kΩ A0 32kΩ - | | ||
+ | Acceleration/ | ||
+ | A mass value of 5 will increase/ | ||
+ | Vstart and Vhigh, CV2/CV5, can be simulated with the __**[[: | ||
+ | ===Electronic Speed Controller=== | ||
+ | An **E**lectronic **S**peed **C**ontroller, | ||
+ | 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==== | ||
+ | {{ : | ||
+ | The serial connector on the WIO PCB can be used to connect it to an amplifier for reading RailCom data.\\ | ||
+ | The GCA214 can be used as amplifier.\\ | ||
+ | The following RailCom IDs are supported: | ||
+ | ^ ID ^ Channel ^ Description ^ | ||
+ | | 0 | 2 | POM read | | ||
+ | | 1 | 1 | Low decoder address | | ||
+ | | 2 | 1 | High decoder address | | ||
+ | The only way to activate RailCom reading in WIO is to set this option in the WIO Dialog. (WIO 0.105, Rocrail 2.1.212)\\ | ||
+ | The serial bps will switch to 250000, and the monitor will be read only. __So with this option active its not possible to setup the WIO by monitor commands.__\\ | ||
\\ | \\ | ||
- | =====Mobile===== | + | ====Sensors==== |
+ | {{ : | ||
+ | One BME280/ | ||
+ | The USER_ALTITUDE in the USERCNF.h must be adjusted to meet the local altitude for correct pressure values.\\ | ||
+ | One TSL2591 ' | ||
+ | ===Dynamic Text=== | ||
+ | Temperature, | ||
+ | See: __**[[: | ||
+ | \\ | ||
+ | |||
+ | |||
+ | ====Sound==== | ||
+ | Sound can be played on ESP32 boards using one of the DAC pins. (GPIO25 or GPIO26)\\ | ||
+ | Supported [[ https:// | ||
+ | * PCM type | ||
+ | * Sample rate 11.025 Hz | ||
+ | * 16 sample bits | ||
+ | * One channel (Mono) | ||
+ | ===Action=== | ||
+ | * Type: Sound | ||
+ | * Command: Play | ||
+ | * Parameter: Sound file incl. path like: "/ | ||
+ | * Interface Bus: WIO ID | ||
+ | Example: | ||
+ | <code xml> | ||
+ | <ac id=" | ||
+ | </ | ||
+ | ===Recommendations=== | ||
+ | The DAC is only capable to use 8 bits. The 16 bit data must be interpreted, | ||
+ | To get the best result: | ||
+ | * 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 ^ | ||
+ | | Servo 5 | IN1 | CLK+ | | ||
+ | | Servo 6 | IN2 | DIR+ | | ||
+ | | Servo 7 | IN3 | ENABLE+ | | ||
+ | | Servo 8 | IN4 | - | | ||
+ | | DA1 | - | | 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 | ||
+ | | Type | wio | | ||
+ | | Decoder steps | Nr of steps for one 360° rotation. \\ In case of a 28BYJ-48: 4096 steps. | | ||
+ | //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=" | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | \\ | ||
+ | |||
+ | ====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 | ||
The WIO can also be used as mobile RFID reader and I/O.\\ | The WIO can also be used as mobile RFID reader and I/O.\\ | ||
The WIO ID must be set in the loco **[[: | The WIO ID must be set in the loco **[[: | ||
Line 447: | Line 740: | ||
* https:// | * https:// | ||
+ | |||
+ | \\ | ||
+ | =====Trouble Shooting===== | ||
+ | ====LOLIN vs Wemos==== | ||
+ | |< >| | ||
+ | | Top || Bottom | ||
+ | | 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 to the I2C bus of the WIO, and has no power, it will slowdown the processing and no other I2C devices are detected. (Multiple seconds between the loop calls.)\\ | ||
+ | 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:// |
arduino/wio-en.txt · Last modified: 2024/03/23 08:03 by rjversluis