wio:wiopi-en
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
wio:wiopi-en [2021/01/09 10:31] – [Supported Hardware] rjversluis | wio:wiopi-en [2024/04/13 16:28] (current) – [Command Line Options] babbel | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== WIOpi ====== | ||
[[: | [[: | ||
- | | + | ====== WIOpi ====== |
+ | [[: | ||
+ | **[[: | ||
+ | * [[: | ||
+ | | ||
+ | | ||
* [[: | * [[: | ||
+ | * [[: | ||
+ | * [[: | ||
\\ | \\ | ||
- | | Work In Progress | ||
{{: | {{: | ||
\\ | \\ | ||
+ | | Before mounting the header on the Zero, check this [[: | ||
+ | |||
+ | < | ||
+ | \\ | ||
+ | =====PiOS Versions===== | ||
+ | ^ Version ^ Remark ^ Date ^ | ||
+ | | PiOS 11 ' | ||
+ | | PiOS 12 ' | ||
+ | --></ | ||
+ | |||
+ | |||
+ | \\ | ||
=====Introduction===== | =====Introduction===== | ||
- | WIOpi is a program targeted for the Raspberry Pi and its GPIO.\\ | + | WIOpi is a program targeted for the Raspberry Pi and its GPIO. (Model 1, 2, 3, 4 and ZeroW.)\\ |
The hardware requirements and support are the same as for __**[[: | The hardware requirements and support are the same as for __**[[: | ||
By running the WIOpi program on the Raspberry Pi, it will behave and process like a WIO on ESP base.\\ | By running the WIOpi program on the Raspberry Pi, it will behave and process like a WIO on ESP base.\\ | ||
Line 16: | Line 33: | ||
^ WIOpi runs in context of user **pi**. ^\\ | ^ WIOpi runs in context of user **pi**. ^\\ | ||
//The user **pi** is default in the groups **gpio**, **i2c** and **spi**, so no need to run WIOpi in super user context.// \\ | //The user **pi** is default in the groups **gpio**, **i2c** and **spi**, so no need to run WIOpi in super user context.// \\ | ||
+ | **Note**: Type mobile should run in root context to be able to run a high performance motor thread.\\ | ||
< | < | ||
$ groups | $ groups | ||
Line 41: | Line 59: | ||
\\ | \\ | ||
+ | |||
+ | =====Supported Boards===== | ||
+ | * Raspberry ZeroW 1 and 2 | ||
+ | * Raspberry Pi 1, 2, 3 and 4 | ||
+ | |||
+ | |||
+ | \\ | ||
+ | |||
=====Install===== | =====Install===== | ||
+ | Activate I2C, SPI and UART in the raspi-conf utility.\\ | ||
< | < | ||
cd | cd | ||
Line 57: | Line 84: | ||
+ | ====Swap Size==== | ||
+ | The default swap size of 100MB ist for a Zero with 512MB memory not enough.\\ | ||
+ | <code bash> | ||
+ | sudo nano / | ||
+ | </ | ||
+ | Change the swap size to 1024: | ||
+ | <code bash> | ||
+ | CONF_SWAPSIZE=1024 | ||
+ | </ | ||
+ | Restart the service: | ||
+ | <code bash> | ||
+ | sudo / | ||
+ | sudo / | ||
+ | </ | ||
\\ | \\ | ||
+ | =====Command Line Options===== | ||
+ | ^ Option ^ Description ^ | ||
+ | | -info | set trace level info | | ||
+ | | -t < | ||
+ | | -server <ip> | Rocrail server IP or DNS name ¹| | ||
+ | | -id < | ||
+ | | -softpwm | Use software PWM for servos to enable play sound. | | ||
+ | |||
- | < | ||
- | --------------------------------------------------- | ||
- | WW WW IIII OOOOOO | ||
- | WW WW II OO OO .. | ||
- | | ||
- | WWWWWWWW | ||
- | | ||
- | pp | ||
- | pp | ||
- | --------------------------------------------------- | ||
- | TM and Copyright 2002-2020 Robert Jan Versluis. | ||
- | All Rights Reserved. | ||
- | | ||
- | | ||
- | --------------------------------------------------- | ||
- | WIOpi 2.1.1021 [Dec 10 2020 07:52:42] | ||
- | --------------------------------------------------- | ||
- | 20201211.153950.005 w9999I main | ||
- | 20201211.153950.005 w9999I main | ||
- | 20201211.153950.010 w9999I main | ||
- | 20201211.153950.012 w9999I main | ||
- | 20201211.153950.017 w9999I main | ||
- | 20201211.153950.021 w9999I main | ||
- | 20201211.153950.022 w9999I main | ||
- | 20201211.153950.023 w9999I main | ||
- | 20201211.153950.034 w9999I main | ||
- | 20201211.153950.035 w9999I main | ||
- | 20201211.153950.038 w9999I main | ||
- | 20201211.153950.105 w9999I main | ||
- | 20201211.153950.712 w9999I wiocon | ||
- | 20201211.153950.936 w9999I wiostat | ||
- | 20201211.153951.105 w9999I doRFID | ||
- | </ | ||
\\ | \\ | ||
+ | ¹ If WIOpi and the Rocrail server are operated on the same Raspberry pi, enter **localhost**. For autostart, enter the option in startwiopi.sh. | ||
+ | |||
=====Pinout===== | =====Pinout===== | ||
The Pinout and mapping is printed in the console after startup.\\ | The Pinout and mapping is printed in the console after startup.\\ | ||
It depends on the configuration found in the wiopi.ini.\\ | It depends on the configuration found in the wiopi.ini.\\ | ||
- | See for Raspberry Pi Pinout information: | + | See for Raspberry Pi Pinout information: |
- | < | + | More detailed info: https:// |
- | -P-I-N-O-U-T--------------------- | + | Or issue in a terminal the pinout command.\\ |
- | | Name | Log | Phys | | + | |
- | +-------------------------------+ | + | |
- | | I2C SDA | 08 | 03 | | + | |
- | | I2C SCL | 09 | 05 | | + | |
- | | Pi01 TxD | + | |
- | | Pi01 RxD | + | |
- | | Pi01 LED1 | 02 | 13 | | + | |
- | | Pi01 LED2 | 07 | 07 | | + | |
- | | Pi01 Button | + | |
- | | Pixel CI | + | |
- | | Pixel DI | + | |
- | | Servo 0 | 26 | 32 | | + | |
- | | Servo 1 | 23 | 33 | | + | |
- | | MCP2515 MOSI | + | |
- | | MCP2515 MISO | + | |
- | | MCP2515 SCLK | + | |
- | | MCP2515 INT | 06 | 22 | | + | |
- | | MCP2515 CSO | 10 | 24 | | + | |
- | | Stepper IN1 | 30 | 27 | | + | |
- | | Stepper IN2 | 21 | 29 | | + | |
- | | Stepper IN3 | 22 | 31 | | + | |
- | | Stepper IN4 | 25 | 37 | | + | |
- | | Stepper CAL | 11 | 26 | | + | |
- | | S88 PS | + | |
- | | S88 RESET | 27 | 36 | | + | |
- | | S88 CLOCK | 28 | 38 | | + | |
- | | S88 DATA | + | |
- | --------------------------------- | + | |
- | </ | + | |
\\ | \\ | ||
Line 135: | Line 123: | ||
* __**[[: | * __**[[: | ||
* __**[[: | * __**[[: | ||
- | * __**[[: | + | * __**[[: |
* __**[[: | * __**[[: | ||
* __**[[: | * __**[[: | ||
Line 144: | Line 132: | ||
* __**[[: | * __**[[: | ||
* __**[[: | * __**[[: | ||
- | * __**[[: | + | * __**[[: |
- | * Mobile soft PWM for controlling a DC Motor (Power | + | * Mobile soft PWM for controlling a DC Motor, MOSFET |
* WS2801 RGB LEDs over SPI (Output address > 128) | * WS2801 RGB LEDs over SPI (Output address > 128) | ||
* LEDScript support in case Port Type is set to Macro. | * LEDScript support in case Port Type is set to Macro. | ||
- | * 2 Servos on the hardware PWM pins (phys. 32 & 33). ((//Note: WIOpi must be started with sudo to be able to use the PWM outputs.// | + | * 2 Servos on the hardware PWM pins (phys. 32 & 33 - address 129 and 130). ((//WIOpi must be started with sudo to be able to use the PWM outputs.// |
- | * Analog inputs: PCF8591 and ADS1115 | + | * Analog inputs: PCF8591 |
+ | |||
+ | **Note:** //The WIOpi only saves servo positions in case of a shutdown.// | ||
+ | |||
+ | \\ | ||
+ | =====Onboard Servos===== | ||
+ | The two onboard servos have address 129 and 130.\\ | ||
+ | Mobile functions 1 and 2 are mapped to those onboard servo addresses.\\ | ||
+ | **Note:** //The WIOpi only saves servo positions in case of a shutdown.// | ||
Line 158: | Line 154: | ||
dtoverlay=pwm-2chan, | dtoverlay=pwm-2chan, | ||
</ | </ | ||
- | The filter is quit simple: (Example is for just one channel.) | + | The filter is quit simple: (Example is for just one channel, and not tested.) |
< | < | ||
1µ | 1µ | ||
Line 197: | Line 193: | ||
\\ | \\ | ||
- | =====Signals on Pi02/ | + | =====Signals on Pi02/Pi08/ |
- | __**[[: | + | __**[[: |
**Pi08**: 1...128 \\ | **Pi08**: 1...128 \\ | ||
- | **Pi02**: 129...256 (mapped on 1...128) \\ | + | **Pi02**: 1...128 \\ |
- | **WS2801** \\ | + | **WS2801**: 129...256 (mapped on 1...128) \\ |
+ | |||
+ | \\ | ||
+ | ===== ID12LA RFID Reader ===== | ||
+ | The default serial device is ''/ | ||
+ | < | ||
+ | serialdev="/ | ||
+ | </ | ||
+ | |< >| | ||
+ | ^ Raspberry pi Model ^ PiOS 10 ^ PiOS 11 ^ | ||
+ | | Zero 1 | / | ||
+ | | Rpi 1 | / | ||
+ | | Zero 2 | /dev/ttyS0 | / | ||
+ | | Rpi 2...4 | /dev/ttyS0 | | ||
+ | |||
+ | **Note:** //Seems to be PiOS version dependent; Check the system.//\\ | ||
\\ | \\ | ||
Line 211: | Line 222: | ||
| 4 Wire ||| | | 4 Wire ||| | ||
^ Function ^ Header ^ GPIO ^ | ^ Function ^ Header ^ GPIO ^ | ||
- | | IN1 (Coil 1) | | + | | IN1 (Coil 1) | |
| GND | 9 | - | | | GND | 9 | - | | ||
- | | IN2 (Coil 2) | | + | | IN2 (Coil 2) | |
- | | IN3 (Coil 3) | | + | | IN3 (Coil 3) | |
- | | IN4 (Coil 4) | | + | | IN4 (Coil 4) | |
- | | HALL (Calibrate) | | + | | HALL (Calibrate) | |
\\ | \\ | ||
Line 223: | Line 234: | ||
| 3 Wire ||| | | 3 Wire ||| | ||
^ Function ^ Header ^ GPIO ^ Example TB6600 ^ | ^ Function ^ Header ^ GPIO ^ Example TB6600 ^ | ||
- | | STEP(Clock) | | + | | STEP(Clock) | |
| GND | 9 | - | EN-, DIR-, CLK- | | | GND | 9 | - | EN-, DIR-, CLK- | | ||
- | | DIR | | + | | DIR | |
- | | ENABLE | | + | | ENABLE | |
- | | HALL (Calibrate) | | + | | HALL (Calibrate) | |
{{ : | {{ : | ||
Line 234: | Line 245: | ||
=====WS2801===== | =====WS2801===== | ||
|< >| | |< >| | ||
- | ^ WS2801 ^ Header ^ Function ^ | + | ^ WS2801 ^ Header |
- | | DI | 19 MOSI | Digital In | | + | | DI | 19 MOSI | 6 |
- | | CI | 23 SCLK | Clock In | | + | | CI | 23 SCLK | 8 |
- | | GND | 25 GND | Ground | | + | | GND | 25 GND | 2 |
====Output settings for LEDScript==== | ====Output settings for LEDScript==== | ||
- | Address > 128.\\ | + | Address > 128 or count, ON Parameter, is set to zero.\\ |
Options Color, Type Macro.\\ | Options Color, Type Macro.\\ | ||
Line 247: | Line 258: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | |||
+ | ====Files==== | ||
+ | * https:// | ||
+ | |||
+ | |||
< | < | ||
Line 271: | Line 287: | ||
| Rpi1/4 top hdr | | | Rpi1/4 top hdr | | ||
| | ||
- | |||
- | |||
- | WIOpi-01 connectors: | ||
- | ============================== | ||
- | 1 x DC Power supply | ||
- | 1 x Pixx RJ12 | ||
- | 2 x I2C 4 | ||
- | 1 x WS2801 | ||
- | 1 x Stepper | ||
- | 2 x Servo 3 | ||
- | 1 x UART 4 | ||
- | 1 x Lights | ||
- | 1 x Motor 2 | ||
- | 2 or 4 x I/O (optional) | ||
- | |||
- | WIOpi-01 components: | ||
- | ============================== | ||
- | 2 x LED | ||
- | 1 x Button | ||
- | 1 x H-Bridge | ||
- | 2 x I2C I/O Extender (optional) | ||
- | 1 x I2C buffer for Pixx RJ12 | ||
Line 323: | Line 317: | ||
http://< | http://< | ||
</ | </ | ||
+ | |||
+ | ====Mobile==== | ||
+ | Function 8 can be used to activate and deactivate the CAM.\\ | ||
\\ | \\ | ||
=====I2C Slaves===== | =====I2C Slaves===== | ||
- | WIOpi supports up to 4 Arduino | + | WIOpi supports up to 4 I2C Slaves.\\ |
The reserved I2C device addresses are 0x7C, 0x7D, 0x7E and 0x7F.\\ | The reserved I2C device addresses are 0x7C, 0x7D, 0x7E and 0x7F.\\ | ||
- | The WIOnano can be used as skeleton:\\ | ||
- | * https:// | ||
To address a pin on a slave, the following parameters are involved: | To address a pin on a slave, the following parameters are involved: | ||
Line 361: | Line 356: | ||
+ | |||
+ | \\ | ||
+ | |||
+ | |||
+ | =====CAN Slaves===== | ||
+ | The [[https:// | ||
+ | The CANGC modules must be programmed as follows: | ||
+ | * Long events (deselect Short events) | ||
+ | * The Node Nr. must be set equal to the module its CAN ID | ||
+ | * The Event Nr. must be set equal to the corresponding port number (1...16) | ||
+ | * SoD 4711 | ||
+ | :!: //The programming must be done by the RCAN library in Rocrail; It is not possible to program CANGCx over WIOpi. The same USBtin can be used for this purpose.// | ||
+ | \\ | ||
+ | ====Setup examples==== | ||
+ | {{: | ||
+ | {{: | ||
+ | ====Rocrail Addressing==== | ||
+ | ^ Object ^ Node ID ^ Address ^ Port ^ | ||
+ | | Sensor | WIOpi Node ID | Event Nr. + (Node Nr. * 256) | - | | ||
+ | | Output/ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | \\ | ||
+ | |||
+ | =====User Pin Definitions===== | ||
+ | To remap pins for Pi01, Stepper and Mobile, the following child nodes in the '' | ||
+ | |||
+ | <code xml> | ||
+ | <wiopi server=" | ||
+ | <pindef fn=" | ||
+ | <pindef fn=" | ||
+ | </ | ||
+ | </ | ||
+ | The **nr** attribute resembles the connector number, __not__ the GPIO.\\ | ||
+ | |||
+ | ^ Name(fn) ^ Description ^ Remark ^ | ||
+ | | LED1 | Pi01 LED1 output | | ||
+ | | LED2 | Pi01 LED2 output | | ||
+ | | Button | Pi01 Button input | | ||
+ | | IN1 | Stepper IN1 output | 3W Clock | | ||
+ | | IN2 | Stepper IN2 output | 3W Dir | | ||
+ | | IN3 | Stepper IN3 output | 3W Enable | | ||
+ | | IN4 | Stepper IN4 output | | ||
+ | | CAL | Stepper calibration input | | ||
+ | | PWM | Mobile PWM output | | ||
+ | | FWD | Mobile forwards relay pulse output | | ||
+ | | REV | Mobile reverse relay pulse output | | ||
+ | | LIGHTS1 | Mobile lights Cab 1 output | | ||
+ | | LIGHTS2 | Mobile lights Cab 2 output | | ||
+ | |||
+ | \\ | ||
+ | |||
+ | =====Auto Server Connect===== | ||
+ | WIOpi use the __**[[: | ||
+ | This service must be __**[[: | ||
+ | \\ | ||
+ | If Auto Server Connect doesn' | ||
+ | <code xml> | ||
+ | <wiopi server=" | ||
+ | </ | ||
+ | WIOpi should be stopped before editing this file: | ||
+ | < | ||
+ | sudo killall wiopi | ||
+ | </ | ||
+ | \\ | ||
+ | \\ | ||
+ | |||
+ | =====Info Level===== | ||
+ | You can edit the startwiopi.sh with sudo nano startwiopi.sh \\ | ||
+ | Add -info behind ./wiopi for information: | ||
+ | < | ||
+ | #!/bin/sh | ||
+ | cd / | ||
+ | sudo ./wiopi -info | ||
+ | </ | ||
+ | This should only be done for testing because of cpu utilization | ||
+ | =====Mobile Dual Motor===== | ||
+ | Locomotives with dual motors require dual H-Bridge support.\\ | ||
+ | Set the " | ||
+ | The second H-Bridge connects to the I/O2 connector on pin 4, 5 and 6.\\ | ||
+ | The __**[[: | ||
+ | |< >| | ||
+ | ^ I/O2 ^ H-Bridge ^ Rpi Conn ^ WIODrive ^ | ||
+ | | 2 | GND | 25 | IBB1-3 | | ||
+ | | 4 | IN2 | 29 | IBB1-2 | | ||
+ | | 5 | IN1 | 31 | IBB1-1 | | ||
+ | | 6 | ENA | 35 | ESC1-3 | | ||
wio/wiopi-en.1610184688.txt.gz · Last modified: 2021/01/09 10:31 by rjversluis