Wiki source code of LSS-2IO Board

Last modified by Eric Nantel on 2023/03/15 07:58

Show last authors
1 {{lightbox image="LSS-2IO.PNG" width="350"/}}
2
3 [[[[image:[email protected]||alt="buy-online.jpg"]]>>https://www.robotshop.com/products/lynxmotion-lss-2io-arduino-compatible-board||rel="noopener noreferrer" target="_blank"]]
4
5 **Table of Contents**
6
7 {{toc/}}
8
9 = Description =
10
11 The Lynxmotion LSS-2IO ("Lynxmotion Smart Servo To Input / Output") module was designed as a multi-purpose, Arduino programmable board intended to "bridge the gap" between a Lynxmotion Smart Servo (LSS) serial bus and regular 3-pin RC servos and 5V sensors. Although a default program is included when shipped, it can be re-programmed using the standard Arduino IDE software to communicate with digital, analog or I2C sensors acting as a standard Arduino board. It can also be used as a USB-to-Serial Adapter to directly control a Lynxmotion Smart Servo via USB.
12
13 = Features =
14
15 * Onboard switch to easily select between three communication modes
16 * USB Type-C connector (Earlier model was using USB Mini)
17 * 2x LSS connectors allow for daisy chaining
18 * (((
19 6x three row pins to easily connect 3-pin servos & sensors
20
21 * Digital pins : D9 / D10 / D11 (PWM capable)
22 * Analog & I2C pins : A3 / A4 (SDA) / A5 (SCL)
23 )))
24 * Analog pins 5V rail and Logic 5V are separately powered by two on-board 5V regulators.
25 * LED (red): Tx-Rx USB serial activity (Tx & Rx)
26 * LED (green): Power LED (PWR)
27 * LED (RGB): Controlled by the user
28 * Arduino bootloader installed & Arduino IDE compatible
29 * Lynxmotion Smart Servo (LSS) mounting pattern
30 * Same form factor as the** **[[LSS - Power Hub>>doc:servo-erector-set-system.ses-electronics.ses-modules.lss-power-hub.WebHome||rel="noopener noreferrer" target="_blank"]]
31
32 = Specifications =
33
34 * Microcontroller: ATMega328P
35 * USB-to-Serial IC: CH340E ([[Driver Download>>https://translate.google.ca/translate?sl=auto&tl=en&u=http%3A%2F%2Fwch.cn%2Fdownloads%2FCH341SER_EXE.html]])
36 * Logic voltage: 5V
37 * Analog voltage rail: 5V
38 * Logic 5V maximum current: 200mA
39 * Analog 5V rail maximum current: 1.2A
40 * Number of analog pins: 3
41 * Number of digital IO pins: 3
42 * Input voltage via LSS connector: 6V-12V
43 * Maximum rated current through LSS connectors: 2A
44 * Default baud rate in 2RC mode (with LSS-2IO Arduino program pre-loaded): 115200
45
46 = Pinout =
47
48 |(% colspan="3" style="width:350px" %)(((
49 (% class="wikigeneratedid" id="HExternalPins26Connectors" %)
50 **External Pins & Connectors**
51 )))
52 |(% rowspan="7" style="width:300px" %){{lightbox image="LSS-2IO-External.png"/}}|(% style="vertical-align:middle; width:35px" %)[[image:[email protected]]]|(% style="vertical-align:middle" %)**Vin**: Input voltage supplied by LSS bus (6V to ~~12V).
53 |(% style="vertical-align:middle" %)[[image:[email protected]]]|(% style="vertical-align:middle" %)**Ground (G)**: Common ground.
54 |(% style="vertical-align:middle" %)[[image:[email protected]||alt="SQUARE-Blue.png"]]|(% style="vertical-align:middle" %)**Vout**: Output voltage from onboard 5VDC regulator.
55 |(% style="vertical-align:middle" %)[[image:[email protected]]]|(% style="vertical-align:middle" %)**LSS Rx**
56 |(% style="vertical-align:middle" %)[[image:[email protected]]]|(% style="vertical-align:middle" %)**LSS Tx**
57 |(% style="vertical-align:middle" %)[[image:[email protected]||alt="SQUARE-Red.png"]]|(% style="vertical-align:middle" %)(((
58 **3x Digital Pins (D9, D10, D11): **PWM Capable.
59 )))
60 |(% style="vertical-align:middle" %)[[image:[email protected]||alt="SQUARE-Red.png"]]|(% style="vertical-align:middle" %)(((
61 **3x Analog Pins (A3, A4, A5)**
62 )))
63
64 |(% colspan="3" style="width:350px" %)(((
65 (% class="wikigeneratedid" id="HInternalConnections" %)
66 **Internal Connections**
67 )))
68 |(% colspan="1" rowspan="5" style="width:300px" %){{lightbox image="LSS-2IO-Internal.png"/}}|(% style="vertical-align:middle; width:35px" %)[[image:[email protected]]]|(% style="vertical-align:middle" %)(((
69 **Pin D3: **RGB LED red.
70 )))
71 |(% style="vertical-align:middle" %)[[image:[email protected]]]|(% style="vertical-align:middle" %)(((
72 **Pin D6: **RGB LED green.
73 )))
74 |(% style="vertical-align:middle" %)[[image:[email protected]||alt="SQUARE-Red.png"]]|(% style="vertical-align:middle" %)(((
75 **Pin D5: **RGB LED blue.
76 )))
77 |(% style="vertical-align:middle" %)[[image:[email protected]]]|(% style="vertical-align:middle" %)(((
78 **Pin D14: **Controls the tri-state buffer (IC3) on the ATMega328P Tx serial line (pulled-down).
79 )))
80 |(% style="vertical-align:middle" %)[[image:[email protected]]]|(% style="vertical-align:middle" %)**Pin D7: **Controls the tri-state buffer (IC4) on CH340E Tx / ATMega328P Rx serial line (pulled-up).
81
82 = Power =
83
84 |(% colspan="1" rowspan="4" style="width:300px" %){{lightbox image="LSS-2IO-Power.png"/}}|(% style="vertical-align:middle; width:35px" %)[[image:[email protected]]]|(% style="vertical-align:middle" %)**LSS Connectors: **The board is meant to be powered from ONE of the two LSS connectors. Vin will supply the two on-board 5V regulators (logic and Vout) and to the Lynxmotion Smart Servos connected on the bus. Refer to LSS Voltage rating in [[LSS - Specifications>>doc:lynxmotion-smart-servo.lss-specifications.WebHome||rel="noopener noreferrer" target="_blank"]]
85 |(% style="vertical-align:middle; width:35px" %)[[image:[email protected]||alt="SQUARE-Red.png"]]|(% style="vertical-align:middle" %)(((
86 **USB: **Connecting only the USB will only provide voltage to the logic. It won't power Vout rail nor LSS connected on the bus.
87 )))
88 |(% style="vertical-align:middle; width:35px" %)[[image:[email protected]]]|(% style="vertical-align:middle" %)**Vout**: Output voltage rail from onboard 5VDC regulator. Intended to supply sensors requiring low current.
89 |(% style="vertical-align:middle; width:35px" %)[[image:[email protected]]]|(% style="vertical-align:middle" %)(((
90 **Digital Pin Supply:** This rmiddle rail need to be powered from an external power supply depending on what device is connected to the digital pins.
91
92 [[LSS 5VR Board>>doc:servo-erector-set-system.ses-electronics.ses-modules.lss-5vr.WebHome||rel="noopener noreferrer" target="_blank"]] could be used to supply 5V/2A.
93 )))
94
95 {{warningBox warningText="**NOTE:** USB and Vin power source are isolated and there are no issues connecting both a USB and a powered LSS bus at the same time"/}}
96
97
98
99 = Communication Modes =
100
101 The LSS 2IO Board has three serial communication modes which are selected using the switch SW1. The board is shipped in the 2RC ("to R/C") Mode, pre-loaded with the Lss2IO Arduino program (in the [[AlternativeLSS Arduino Library>>https://github.com/Lynxmotion/AlternativeLSS/]]). The three communication modes are explained below. It is important to note that modes are often a combination of the switch position and the Arduino code running in the ATMega328P chip.
102
103 == 2RC Mode (as shipped with sample code) ==
104
105 (% style="margin-right:auto" %)
106 |(% style="text-align:left; width:300px" %)**Switch Position**|(% style="text-align:left" %)**Mode Information**
107 |(% style="width:300px" %){{lightbox image="LSS-2IO-Mode-2RC.png"/}}|(((
108 In this mode, with the right code, the 2IO Board behaves as a "peripheral" device and allows for control of multiple RC servos and IO that can be daisy-chained on the LSS bus through the LSS connectors. To use this mode, have the Lss2IO Arduino program (in the [[AlternativeLSS Arduino Library>>https://github.com/Lynxmotion/AlternativeLSS/]]) running on the ATMega328P chip and move the switch to the "2RC" position. The 2IO Board will process LSS protocol commands to query information from sensors or send action commands to RC servos attached to the IO pins of the 2IO Board.
109
110 (((
111 **Use-cases :**
112
113 * Control RC Servos (pins D9, D10 and D11) to the LSS Bus and control them using the [[2RC Communication Protocol>>doc:servo-erector-set-system.ses-electronics.ses-modules.lss-2io-board.2io-2rc-mode-communication-protocol.WebHome||rel="noopener noreferrer" target="_blank"]] which is a reduced version of the [[LSS Protocol>>doc:lynxmotion-smart-servo.lss-communication-protocol.WebHome||rel="noopener noreferrer" target="_blank"]].
114 ** Example: #209D900<cr>. This moves the RC servo connected to pin D9 to an angle of 90 degrees. More information on the 2IO Communication Protocol [[here>>doc:servo-erector-set-system.ses-electronics.ses-modules.lss-2io-board.2io-2rc-mode-communication-protocol.WebHome||rel="noopener noreferrer" target="_blank"]].
115 * Query analog 5V sensors (pin A3, A4 and A5) using the [[2RC Communication Protocol>>doc:servo-erector-set-system.ses-electronics.ses-modules.lss-2io-board.2io-2rc-mode-communication-protocol.WebHome||rel="noopener noreferrer" target="_blank"]] which is a refined version of the [[LSS Protocol>>doc:lynxmotion-smart-servo.lss-communication-protocol.WebHome||rel="noopener noreferrer" target="_blank"]].
116 ** Example: #203QA<cr>. This will return the raw value of the analog sensor connected to pin A3. More information on the 2IO Communication Protocol [[here>>doc:servo-erector-set-system.ses-electronics.ses-modules.lss-2io-board.2io-2rc-mode-communication-protocol.WebHome||rel="noopener noreferrer" target="_blank"]].
117 )))
118 )))
119
120 |**Sample Wiring / Use**
121 |{{lightbox image="LSS-2IO-Wiring-2RC.PNG" width="900"/}}
122
123 **Internal Serial Connection**
124
125 In this mode, the board is effectively a "peripheral". In order to respond to LSS commands, it needs to be running appropriate code, or the default Lss2IO Arduino sample program. The pinout is as follows:
126
127 * ATMega328P's Tx pin (D1) is connected to the LSS Tx line through a [[tri-state buffer (IC3)>>https://en.wikipedia.org/wiki/Three-state_logic||rel="noopener noreferrer" target="_blank"]] that can be enabled or disabled with pin D14.
128 * ATMega328P's Rx pin (D0) is connected to the LSS Rx line.
129
130 Therefore data that is sent from an external UART device will be received on the LSS Rx line and the ATMega328P Rx pin. The LSS 2IO USB-to-Serial IC Tx is connected to the ATMega328P Rx (pin D0) through another [[tri-state buffer (IC4)>>https://en.wikipedia.org/wiki/Three-state_logic||rel="noopener noreferrer" target="_blank"]] that can be enabled/disabled with pin D7. The Lss2IO Arduino code inherently takes care of managing the pins D14 and D7 as follows :
131
132 * **D7 **is LOW**: **to disconnect LSS 2IO USB-to-Serial IC Tx from ATMega328P Rx (pin D0) allowing the ATMega328P to receive data from the UART controller device as LSS 2IO USB-to-Serial IC Tx is HIGH when LSS 2IO is powered.
133 * **D14** is HIGH**:** when the 2IO Board is sending data on the LSS Tx line to an external UART device Rx pin. LSS Tx line is asserted to the 2IO Tx pin :
134
135 {{lightbox image="LSS-2IO-Schematic-2RC-D14HIGH.png" width="900"/}}
136
137 * **D14 **is LOW**:** when the 2IO Board is not sending data on the LSS Tx line. The 2IO frees up the LSS Tx line to avoid bus congestion (when 2 devices sends data at the same time) :
138
139 {{lightbox image="LSS-2IO-Schematic-2RC-D14LOW.png" width="900"/}}
140
141 {{warningBox warningText="**NOTE:** Double check that the Lss2IO Arduino program is loaded in the 2IO's ATMega328P to be able to use this mode"/}}
142
143
144
145 **Pin / ID Default Assignment**
146
147 The following pinout is used in the sample code so as to not interfere with any other guides or manuals. This pinout can be changed in the Arduino program.
148
149 (% style="width:459px" %)
150 |(% style="width:111px" %)**PIn/Device**|(% style="width:52px" %)**ID**|(% style="width:139px" %)**Middle Pin Supply**|(% style="width:135px" %)**Notes**
151 |(% style="width:111px" %)2IO Master ID|(% style="width:52px" %)207|(% style="width:139px" %)-|(% style="width:135px" %)RGB LED
152 |(% style="width:111px" %)A3|(% style="width:52px" %)203|(% style="width:139px" %)5V|(% style="width:135px" %)Analog Pin
153 |(% style="width:111px" %)A4|(% style="width:52px" %)204|(% style="width:139px" %)5V|(% style="width:135px" %)Analog Pin
154 |(% style="width:111px" %)A5|(% style="width:52px" %)205|(% style="width:139px" %)5V|(% style="width:135px" %)Analog Pin
155 |(% style="width:111px" %)D9|(% style="width:52px" %)209|(% style="width:139px" %)Not Connected|(% style="width:135px" %)Digital Pin
156 |(% style="width:111px" %)D10|(% style="width:52px" %)210|(% style="width:139px" %)Not Connected|(% style="width:135px" %)Digital Pin
157 |(% style="width:111px" %)D11|(% style="width:52px" %)211|(% style="width:139px" %)Not Connected|(% style="width:135px" %)Digital Pin
158 |(% colspan="4" style="width:111px" %)To change the ID,s you can look at the "CID" command [[HERE>>https://wiki.lynxmotion.com/info/wiki/lynxmotion/view/servo-erector-set-system/ses-electronics/ses-modules/lss-2io-board/2io-2rc-mode-communication-protocol/#H6.IdentificationNumber28ID29]]
159
160 {{warningBox warningText="**NOTE:** For a Factory Reset of the 2IO Board in the 2RC Mode, hold the LSS Rx line LOW on power-up by connecting LSS Rx to Ground (Refer to Pinout section). 2IO RGB LED will cycle between RED-GREEN-BLUE. Keep holding LSS Rx LOW until the LED start blinking white. At this point, the Firmware is reset and the jumper can be removed. It will RESET after 3 white blink cycles. If jumper is still connected it will enter Firmware reset again."/}}
161
162
163
164 == Arduino ==
165
166 |(% style="text-align:left; width:300px" %)**Switch Position**|(% style="text-align:left" %)**Mode Information**
167 |(% style="width:300px" %){{lightbox image="LSS-2IO-Mode-Arduino.png"/}}|(((
168 In this mode, the 2IO Board acts as a "controller", or an Arduino-based robot controller / "Robot Brain" that can control LSS servos. When in Arduino mode, the 2IO board can be loaded with any Arduino program / sketch via the [[Arduino IDE>>https://www.arduino.cc/en/main/software||rel="noopener noreferrer" target="_blank"]]. In IDE, select "Tools -> **Arduino Nano"** and "**ATMega328P** Processor" should be selected. Making sure that the correct COM port is also selected (which is computer dependent). The [[Official Lynxmotion Smart Servo (LSS) Arduino Library & Examples>>https://github.com/Lynxmotion/LSS_Library_Arduino||rel="noopener noreferrer" target="_blank"]] could be a good starting point.
169
170 (((
171 **Use-cases:**
172
173 * The LSS 2IO Board controls a robotic platform built using Lynxmotion Smart Servos (LSS)
174 * The 2IO Board is used as an Arduino Compatible board to light LEDs, control RC servos, read sensors and much more.
175 )))
176 )))
177
178 |**Sample Wiring / Use**
179 |{{lightbox image="LSS-2IO-Wiring-Arduino.PNG" width="900"/}}
180
181 **Internal Serial Connections**
182
183 In this mode, the board is effectively a "peripheral". With the 2IO Board in Arduino mode:
184
185 * ATMega328P Tx pin (D1) is connected to the LSS Rx line
186 * ATMega328P Rx pin (D0) is connected to the LSS Tx line. Therefore, the 2IO can send and receive data to/from LSS servos.
187
188 {{warningBox warningText="**NOTE:** It is important to set D7 LOW in your Arduino sketch to disconnect LSS 2IO USB-to-Serial IC Tx from ATMega328P Rx (pin D0) through the tri-state buffer (IC4) allowing the ATMega328P to be able to receive data from the LSS."/}}
189
190
191
192 {{lightbox image="LSS-2IO-Schematic-Arduino.png" width="900"/}}
193
194 == Direct (USB to Serial) ==
195
196 |(% style="text-align:left; width:300px" %)**Switch Position**|(% style="text-align:left" %)**Mode Information**
197 |(% style="width:300px" %){{lightbox image="LSS-2IO-Mode-Direct.png"/}}|(((
198 In this mode, the LSS 2IO Board will act as a USB-to-UART converter allowing to control Lynxmotion Smart Servos (LSS) with a USB device (Computer, Raspberry Pi, etc..). To use this mode, the switch should be in the "Direct" position**. **It is also important to make sure that the ATMega328P is not loaded with a sketch making use of the ATMega328P hardware serial pins (D0 and D1).** **The best way to make sure of that, would be to load a **"BareMnimum"** Arduino sketch that can be found in [[Arduino IDE>>https://www.arduino.cc/en/main/software||rel="noopener noreferrer" target="_blank"]] File -> Examples -> 01.Basics. The pin D7 should also not be set LOW (by default, this pin is HIGH by a pull-up resistor R1).
199
200 (((
201 **Use-cases :**
202
203 * Configure or control an LSS using [[LSS Configuration Software>>doc:lynxmotion-smart-servo.lss-configuration-software.WebHome||rel="noopener noreferrer" target="_blank"]] with a computer
204 )))
205 )))
206
207 |**Sample Wiring / Use**
208 |{{lightbox image="LSS-2IO-Wiring-Direct.PNG" width="900"/}}
209
210 **Internal Serial Connections**
211
212 With the 2IO Board in Direct mode (Switch on "Direct" position), the USB-to-Serial IC Rx is connected to the LSS Tx line and the USB-to-Serial IC Tx is connected to the LSS Rx line. Therefore, the USB Device can send and receive data to/from LSS servos.
213
214 {{warningBox warningText="**NOTE:** It is important to make sure that the ATMega328P is not loaded with a sketch making use of the ATMega328P hardware serial pins (D0 and D1) and that the pin D7 is NOT set LOW"/}}
215
216
217
218 {{lightbox image="LSS-2IO-Schematic-Direct.png" width="900"/}}
219
220 = Advanced Pinout =
221
222 {{lightbox image="LSS-2IO-PINOUT.png" width="700"/}}
223
224 = Dimensions & Mounting =
225
226 |(% style="width:300px" %){{lightbox image="LSS-2IO-Dimensions.png"/}}|(% style="width:300px" %)[[image:LSS-2IO-Mounting.gif]]|
Copyright RobotShop 2018