Wiki source code of LSS - 2MC Board

Version 5.1 by Eric Nantel on 2021/04/06 13:23

Show last authors
1 {{lightbox image="LSS-2MC.png" width="350"/}}
2
3 [[[[image:[email protected]||alt="buy-online.jpg"]]>>https://www.robotshop.com/en/lynxmotion-lss-2io-arduino-compatible-board.html||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 * Dual H-Bridge motor driver (DRV8847SPWR)
16 * USB Type-C connector
17 * 2x LSS connectors allow for daisy chaining
18 * Unpopulated A3 pin under the USB Type-C
19 * LED (red): Tx-Rx USB serial activity (Tx & Rx)
20 * LED (green): Power LED (PWR)
21 * LED (RGB): Controlled by the user
22 * Arduino bootloader installed & Arduino IDE compatible
23 * Lynxmotion Smart Servo (LSS) mounting pattern
24 * 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"]] / [[doc:servo-erector-set-system.ses-electronics.ses-modules.lss-2io-board.WebHome]] / [[doc:servo-erector-set-system.ses-electronics.ses-modules.lss-5vr.WebHome]]
25
26 = Specifications =
27
28 * Microcontroller: ATMega328P
29 * 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]])
30 * Logic voltage: 5V
31 * Analog voltage: 5V
32 * Logic 5V maximum current: 200mA
33 * Analog 5V rail maximum current: 1.2A
34 * Number of analog pins: 3
35 * Number of digital IO pins: 3
36 * Input voltage via LSS connector: 6V-12V
37 * Maximum rated current through LSS connectors: 2A
38 * Default baud rate in 2RC mode (with LSS-2IO Arduino program pre-loaded): 115200
39
40 = Pinout =
41
42 |(% colspan="3" style="width:350px" %)(((
43 (% class="wikigeneratedid" id="HExternalPins26Connectors" %)
44 **External Pins & Connectors**
45 )))
46 |(% 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).
47 |(% style="vertical-align:middle" %)[[image:[email protected]]]|(% style="vertical-align:middle" %)**Ground (G)**: Common ground.
48 |(% style="vertical-align:middle" %)[[image:[email protected]||alt="SQUARE-Blue.png"]]|(% style="vertical-align:middle" %)**Vout**: Output voltage from onboard 5VDC regulator.
49 |(% style="vertical-align:middle" %)[[image:[email protected]]]|(% style="vertical-align:middle" %)**LSS Rx**
50 |(% style="vertical-align:middle" %)[[image:[email protected]]]|(% style="vertical-align:middle" %)**LSS Tx**
51 |(% style="vertical-align:middle" %)[[image:[email protected]||alt="SQUARE-Red.png"]]|(% style="vertical-align:middle" %)(((
52 **3x Digital Pins (D9, D10, D11): **PWM Capable.
53 )))
54 |(% style="vertical-align:middle" %)[[image:[email protected]||alt="SQUARE-Red.png"]]|(% style="vertical-align:middle" %)(((
55 **3x Analog Pins (A3, A4, A5)**
56 )))
57
58 |(% colspan="3" style="width:350px" %)(((
59 (% class="wikigeneratedid" id="HInternalConnections" %)
60 **Internal Connections**
61 )))
62 |(% 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" %)(((
63 **Pin D3: **RGB LED red.
64 )))
65 |(% style="vertical-align:middle" %)[[image:[email protected]]]|(% style="vertical-align:middle" %)(((
66 **Pin D6: **RGB LED green.
67 )))
68 |(% style="vertical-align:middle" %)[[image:[email protected]||alt="SQUARE-Red.png"]]|(% style="vertical-align:middle" %)(((
69 **Pin D5: **RGB LED blue.
70 )))
71 |(% style="vertical-align:middle" %)[[image:[email protected]]]|(% style="vertical-align:middle" %)(((
72 **Pin D14: **Controls the tri-state buffer (IC3) on the ATMega328P Tx serial line (pulled-down).
73 )))
74 |(% 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).
75
76 = Power =
77
78 |(% 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"]]
79 |(% style="vertical-align:middle; width:35px" %)[[image:[email protected]||alt="SQUARE-Red.png"]]|(% style="vertical-align:middle" %)(((
80 **USB: **Connecting only the USB will only provide voltage to the logic. It won't power Vout rail nor LSS connected on the bus.
81 )))
82 |(% 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.
83 |(% style="vertical-align:middle; width:35px" %)[[image:[email protected]]]|(% style="vertical-align:middle" %)(((
84 **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.
85
86 [[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.
87 )))
88
89 {{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"/}}
90
91
92
93 = Communication Modes =
94
95 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.
96
97 == 2RC Mode (as shipped with sample code) ==
98
99 (% style="margin-right:auto" %)
100 |(% style="text-align:left; width:300px" %)**Switch Position**|(% style="text-align:left" %)**Mode Information**
101 |(% style="width:300px" %){{lightbox image="LSS-2IO-Mode-2RC.png"/}}|(((
102 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.
103
104 (((
105 **Use-cases :**
106
107 * 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"]].
108 ** 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"]].
109 * 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"]].
110 ** 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"]].
111 )))
112 )))
113
114 |**Sample Wiring / Use**
115 |{{lightbox image="LSS-2IO-Wiring-2RC.PNG" width="900"/}}
116
117 **Internal Serial Connection**
118
119 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:
120
121 * 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.
122 * ATMega328P's Rx pin (D0) is connected to the LSS Rx line.
123
124 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 :
125
126 * **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.
127 * **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 :
128
129 {{lightbox image="LSS-2IO-Schematic-2RC-D14HIGH.png" width="900"/}}
130
131 * **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) :
132
133 {{lightbox image="LSS-2IO-Schematic-2RC-D14LOW.png" width="900"/}}
134
135 {{warningBox warningText="**NOTE:** Double check that the Lss2IO Arduino program is loaded in the 2IO's ATMega328P to be able to use this mode"/}}
136
137
138
139 **Pin / ID Default Assignment**
140
141 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.
142
143 (% style="width:459px" %)
144 |(% style="width:111px" %)**PIn/Device**|(% style="width:52px" %)**ID**|(% style="width:139px" %)**Middle Pin Supply**|(% style="width:135px" %)**Notes**
145 |(% style="width:111px" %)2IO Master ID|(% style="width:52px" %)207|(% style="width:139px" %)-|(% style="width:135px" %)RGB LED
146 |(% style="width:111px" %)A3|(% style="width:52px" %)203|(% style="width:139px" %)5V|(% style="width:135px" %)Analog Pin
147 |(% style="width:111px" %)A4|(% style="width:52px" %)204|(% style="width:139px" %)5V|(% style="width:135px" %)Analog Pin
148 |(% style="width:111px" %)A5|(% style="width:52px" %)205|(% style="width:139px" %)5V|(% style="width:135px" %)Analog Pin
149 |(% style="width:111px" %)D9|(% style="width:52px" %)209|(% style="width:139px" %)Not Connected|(% style="width:135px" %)Digital Pin
150 |(% style="width:111px" %)D10|(% style="width:52px" %)210|(% style="width:139px" %)Not Connected|(% style="width:135px" %)Digital Pin
151 |(% style="width:111px" %)D11|(% style="width:52px" %)211|(% style="width:139px" %)Not Connected|(% style="width:135px" %)Digital Pin
152 |(% colspan="4" style="width:111px" %)To change the ID,s you can look at the "CID" command [[HERE>>https://www.robotshop.com/info/wiki/lynxmotion/view/servo-erector-set-system/ses-electronics/ses-modules/lss-2io-board/2io-2rc-mode-communication-protocol/#H6.IdentificationNumber28ID29]]
153
154 {{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."/}}
155
156
157
158 == Arduino ==
159
160 |(% style="text-align:left; width:300px" %)**Switch Position**|(% style="text-align:left" %)**Mode Information**
161 |(% style="width:300px" %){{lightbox image="LSS-2IO-Mode-Arduino.png"/}}|(((
162 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.
163
164 (((
165 **Use-cases:**
166
167 * The LSS 2IO Board controls a robotic platform built using Lynxmotion Smart Servos (LSS)
168 * The 2IO Board is used as an Arduino Compatible board to light LEDs, control RC servos, read sensors and much more.
169 )))
170 )))
171
172 |**Sample Wiring / Use**
173 |{{lightbox image="LSS-2IO-Wiring-Arduino.PNG" width="900"/}}
174
175 **Internal Serial Connections**
176
177 In this mode, the board is effectively a "peripheral". With the 2IO Board in Arduino mode:
178
179 * ATMega328P Tx pin (D1) is connected to the LSS Rx line
180 * ATMega328P Rx pin (D0) is connected to the LSS Tx line. Therefore, the 2IO can send and receive data to/from LSS servos.
181
182 {{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."/}}
183
184
185
186 {{lightbox image="LSS-2IO-Schematic-Arduino.png" width="900"/}}
187
188 == Direct (USB to Serial) ==
189
190 |(% style="text-align:left; width:300px" %)**Switch Position**|(% style="text-align:left" %)**Mode Information**
191 |(% style="width:300px" %){{lightbox image="LSS-2IO-Mode-Direct.png"/}}|(((
192 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).
193
194 (((
195 **Use-cases :**
196
197 * 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
198 )))
199 )))
200
201 |**Sample Wiring / Use**
202 |{{lightbox image="LSS-2IO-Wiring-Direct.PNG" width="900"/}}
203
204 **Internal Serial Connections**
205
206 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.
207
208 {{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"/}}
209
210
211
212 {{lightbox image="LSS-2IO-Schematic-Direct.png" width="900"/}}
213
214 = Advanced Pinout =
215
216 {{lightbox image="LSS-2IO-PINOUT.png" width="700"/}}
217
218 = Dimensions & Mounting =
219
220 |(% style="width:300px" %){{lightbox image="LSS-2IO-Dimensions.png"/}}|(% style="width:300px" %)[[image:LSS-2IO-Mounting.gif]]|
Copyright RobotShop 2018