Skip to content

Commit eb3bffa

Browse files
authored
RS485 adapter and small updates (#8)
* typos, updated getting started * DIP Switch Address * added RS485 adapter, minor updates * added PWM and LEDs
1 parent 8474f15 commit eb3bffa

5 files changed

Lines changed: 32 additions & 11 deletions

File tree

14.4 KB
Loading
452 Bytes
Loading
-567 KB
Loading

docs/ppuc_hardware/index.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,20 @@ Use a paired cable (like speaker cable). Recommendation for wire cross section i
130130
![solenoid wiring](../images/hardware/solenoid_wire.png)
131131

132132
### Direct LED
133-
To connect a LED (including rectifier, current limiting resistor and capacitor) you can use a mid power output that closes the circuit to ground (same is true for drivers of the matrix boards wich could also be used). Therefore the LED must be supplied with a voltage of typically 6.3 V but 5 V will do as well with slightly reduced brightness. You could also use a high power output. In that case connect it like a solenoid and don't forget to adjust the PWM in the config file for correct voltage.
133+
To connect a LED (including rectifier, current limiting resistor and capacitor) you can use a mid power output that closes the circuit to ground (same is true for drivers of the matrix boards wich could also be used). Therefore the LED must be supplied with a voltage of typically 6.3 V but 5 V will do as well with slightly reduced brightness.
134134

135135
Recommendation for wire cross section is 0.25 mm². You can roughly estimate a maximum current of 20 mA per LED.
136136

137+
<a id="section_pwm_and_leds"></a>
138+
#### PWM and LEDs
139+
You could also use a high power output and connect them like solenoids (with adjusted PWM value in the config file). In that case usually (depending on your voltage) an additional filter circuit is necessary. Unfiltered LEDs may burn if operated with a pulse current bigger than double the rated current. So be careful if you want reduce the voltage more than a factor of two. Many LEDs have a built in filter (they are called "flicker free" or likewise). Unfortunately no technical data is available, so you have to find out yourself. For example, the filtered LEDs I used were good at a factor of 4 (25 % PWM at 24 V) but burnt at a factor of 8 (12.5 % PWM at 48 V).
140+
137141
![direct led schematic](../images/hardware/direct_led_scm.png)
138142

139143
![direct led wiring](../images/hardware/direct_led_wire.png)
140144

141145
### LED Matrix
142-
A LED matrix can only be controlled by the Out_8x10 board. Like in the switch matrix every LED must have a diode in series. The LEDs are connected to the high-side and low-side switches of the Out_8x10 board. Be aware that you need a high supply voltage (20 V) for the matrix as the LEDs are only on for a short time.
146+
A LED matrix can only be controlled by the Out_8x10 board. Like in the switch matrix every LED must have a diode in series. The LEDs are connected to the high-side and low-side switches of the Out_8x10 board. Be aware that you need a high supply voltage (20 V) for the matrix as the LEDs are only on for a short time. Also be aware that the LEDs must have a filter (usually a resistor and capacitor) inside (called "flicker free" or likewise). See also chapter [PWM and LEDs](#section_pwm_and_leds).
143147

144148
Recommendation for wire cross section is 0.25 mm². You can roughly estimate a maximum current of 20 mA per LED.
145149

@@ -148,10 +152,10 @@ Recommendation for wire cross section is 0.25 mm². You can roughly estimate a m
148152
![led matrix wiring](../images/hardware/led_matrix_wire.png)
149153

150154
### LED Flasher
151-
Flashers are connected like direct LEDs. Use a mid power output or connect them like solenoids (with adjusted PWM value in the config file).
155+
Flashers are connected like direct LEDs. Use a mid power output or connect them like solenoids (with adjusted PWM value in the config file). See also chapter [PWM and LEDs](#section_pwm_and_leds).
152156

153157
### General Illumination (GI)
154-
The GI (consisting of several LEDs in parallel) are usually connected like solenoids (with adjusted PWM value in the config file). But you can also use a mid power output (likewise the direct LEDs).
158+
The GI can be connected like direkt LEDs (consisting of several LEDs in parallel). Use mid power outputs or high power outputs. When using higher voltages with PWM make sure you also read chapter [PWM and LEDs](#section_pwm_and_leds).
155159

156160
### Controlled LED Strip
157161
Controlled LED strips (e.g. with WS2812B LEDs) are daisy chained LEDs that can be individually controlled. To archive that each LED has a chip inside. Power supply is 5 V and the single data line is connected to a special terminal (#25).
@@ -198,12 +202,28 @@ The bus connection shall be made in a line topology (one board to the next) usin
198202
* IO_16_8_1: set JP2 for termination. Set JP1 and JP3 for biasing.
199203
* IO_16x8_matrix, Opto_16, Out_8x10: set JP1 for termination (no biasing possible)
200204

201-
Use only exactly one bias network on the bus (no matter where). Terminate the bus at the geometrical start and at the geometrical end (not in between) and never add more than these two terminations.
205+
Use only exactly one bias network on the bus (no matter where). Terminate the bus at the start (usually an adapter connected to the PC or Raspberry Pi) and at the end (the last board in line). Don't terminate in between and never add more than these two terminations.
202206

203207
![bus termination and bias](../images/hardware/bus_term_bias.png)
204208

205209
If you use a shielded cable you can connect the shield to the terminal called SHD. Shielding is not mandatory but twisted pair cable is recommended.
206210

211+
## RS485 Adapters
212+
To connect the bus to a PC or Raspberry Pi, usually an adapter from USB to RS485 is used.
213+
214+
![USB to RS485 adapter](../images/hardware/rs485adapter.jpg)
215+
216+
These adapters come with different chips to to the job, which can be a source of issues. Additionally the chips can be configured by the operating system regarding the timing and buffers. In many applications this configuration is set for a minimum load for the operating system. In our use case it should be set to perform a rather quick response (small buffers, low latency timing).
217+
218+
Here is an example of the an FTDI chip FT232B: it won't work because of the latency timing. This is set to 16 ms per default. When changed to 2 ms it works with PPUC.
219+
In Linux the setting can be changed in this device-file:
220+
/sys/bus/usb-serial/devices/ttyUSB0/latency_timer
221+
Just change the number from 16 to 2 with an text editor.
222+
223+
Another example: with the chip ch341 no changes are needed.
224+
225+
If you have more examples please let us know or write it down here.
226+
207227

208228
## Thoughts on Power Supply
209229
It can kill you! Be aware that you work with deadly voltages, especially on the primary side. If you don't know exactly what you are doing, leave it and ask for help on this part. I repeat: it can kill you, no joke!

docs/ppuc_hardware/io_16_8_1.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# IO_16_8_1
22
This is the hardware for a standard IO card which was designed for the PPUC pinball project, but can be useful in other applications as well.
3-
It is designed for being low cost and functional for experimental use.
4-
Not everything is tested nor does it fulfill EMC or any other specifications.
3+
It is designed for being low cost and functional for experimental use.
4+
Not everything is tested nor does it fulfill EMC or any other specifications.
55
Use at your own risk!
66
To make use of anything of this project a basic understanding of electronics and programming is necessary. Nothing of it is "plug and play". I'm surely not liable for any damage to assemblies, pinball machines or even persons.
77

88
## Picture of the Board
99
![PCB Pic](https://github.com/PPUC/Hardware_IO_16_8_1/raw/main/IO_16_8_1/PCB_V010_TH.jpg)
1010

1111
## Name
12-
[IO_16_8_1](https://github.com/PPUC/Hardware_IO_16_8_1/) as it has 16 inputs, 8 outputs and one special output.
12+
[IO_16_8_1](https://github.com/PPUC/Hardware_IO_16_8_1/) as it has 16 inputs, 8 outputs and one special output.
1313
Actually the inputs can also be used as outputs (see later in this document).
1414

1515
## Power Supply
@@ -39,8 +39,9 @@ The inputs In_2 and In_3 are designed for higher speed (100 kHz). The Pull-Up ca
3939

4040
The input terminals can also be "miss"used for a switch matrix. To do that (no matter if used as coloum or row) the input resistor (330 Ohm) must be short cut (or replaced by a zero Ohm type). Background: the 330 Ohm resistor protects the circuit if the terminal is used as an output and accidently a short cut is done at the terminal. Unfortunately the low voltage value gets too high when used in a switch matrix (diode voltage plus voltage drop due to added up currents through the resistor). This happens when more switches are closed at the same time. Instead you could also use the specially designed PCB "Hardware_IO_16x8_matrix" for your switch matrix.
4141

42-
The inputs In_13 to In_16 have an additional open drain output transistor that allows higher currents in case of being used as an output (up to 3 A at 25 °C ambient temperature). The outputs are internally pulled up by a 10k resistor to 5 V. A higher voltage (max. 30 V) can be applied externally but be sure to have your hardware and software! setup correctly as no protection for damage is provided in that case. Please be aware that the default state (before software takes over control) is "on".
43-
If used as input In_13 to In_16 feature a memory (similar to a relay self-holding function). If the input has ever seen a low signal (e.g. switch closed to GND) it will stay that way until it gets an active high signal from the RP2040 (make the corresponding pin an output with signal "high" and then make it an input again). If this behavior is not wanted you can lift pin 3 of Q13 to Q16, then you have an input/output like e.g. terminal 1 with static behavior but no additional output power.
42+
The inputs In_13 to In_16 have an additional open drain output transistor that allows higher currents in case of being used as an output (up to 3 A at 25 °C ambient temperature). The outputs are internally pulled up by a 10k resistor to 5 V. A higher voltage (max. 30 V) can be applied externally but be sure to have your hardware and software! setup correctly as no protection for damage is provided in that case. Please be aware that the default state (before software takes over control) is "on".
43+
If used as input In_13 to In_16 feature a memory (similar to a relay self-holding function). If the input has ever seen a low signal (e.g. switch closed to GND) it will stay that way until it gets an active high signal from the RP2040 (make the corresponding pin an output with signal "high" and then make it an input again). If this behavior is not wanted you can lift pin 3 of Q13 to Q16, then you have an input/output like e.g. terminal 1 with static behavior but no additional output power.
44+
Why not keep it simple and make all inputs the same? To give the choice to use the terminals as outputs (mid-power) as in pinball use case, there are often too many inputs and a lack on outputs. Therefore an output transistor to 4 of the I/O pins were added to be able to switch more power. As an side effect if this terminal is configured as an input it has this memory or self-holding characteristic (once triggered stays triggered). This can be dealt with by software, so that it actually acts like a normal input. In the end you have the benefit of mid-power-output but the drawback that the software getting more complex for the use case of a "normal" input. If you use the PPUC software and you have configured the terminal as an input, it acts like a normal input and you don't have to care about it.
4445

4546
## High Power Outputs
4647
There are 8 high power outputs available. Usually they are connected to pinball solenoids or flashers. A recovery diode for the solenoids is placed on the pcb, so no need for diodes at the coils. The outputs are open drain and drive currents up to 20 A with a load connected to a voltage of up to 60 V. Be aware that the current is limited by the fuse F2. It will blow within about 1 s at 20 A. You might use a 10 A fuse if necessary.
@@ -54,6 +55,6 @@ One special output is available for high speed signals. The voltage is 5 V, it i
5455
* Connect only one Flipper to a pcb if possible. The advantage is, that all the energy of the big capacitor is available for the flipper, which is usually the solenoid with the highest current. If you have more flipper fingers than PCBs then spread the flipper solenoids as even as possible across the PCBs (e.g. if you have 6 flipper fingers it's better to connect 2 per board instead of all 6 at one board).
5556
* Wire related switches and solenoids for fast flip devices (e.g. flipper, bumper, sling, kick back) to the same pcb. Then you can archive the shortest possible time lag between activating the switch and firing the solenoid.
5657
* RS485 termination: short JP2 at the end of the RS485 bus. There should also be a 120 Ohm resistor at the beginning of the bus (e.g. USB to RS485 adapter).
57-
* RS485 biasing: short JP1 and JP3 exactly once at any point of the RS485 bus. Only do this if no resistors are installed on the USB to RS485 adapter.
58+
* RS485 biasing: short JP1 and JP3 exactly once at any point of the RS485 bus. Only do this if no bias resistors are installed on the USB to RS485 adapter.
5859
* It's recommended to use flipper coils for higher voltage (like 40 - 50 V) as they draw less current. Since Version 1.1.1 low resistance coils (designed for 24 V) should work as well. You should also change the fuse F2 to 10 A for that application.
5960
* If the MOSFETs on the high power outputs are not available (or you want to use the big player brands) here are some alternatives (I haven't tested any of them, but they should work according to their specification): GL40N10A4 (seems to be the same as NCE0140KA), RD3P200SNFRA, NVD6824NL, IPD90N10S4L-06, LSGG10R085W3

0 commit comments

Comments
 (0)