Skip to content

Commit 34157fe

Browse files
committed
Adding docs for the seeed led PCB
1 parent ca46c6e commit 34157fe

12 files changed

+4955
-4
lines changed

docs/01_Toolboxes/02_DiscoveryElectronics/01_automation_intro.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ This command will move the Z-axis motor by -1000 steps (1 full rotation) at a sp
8484

8585
**[VIDEO:] Connect Motor:**
8686

87-
<iframe width="560" height="315" src="https://www.youtube.com/embed/TsWAeWl2T10?si=Z3GzSg2Xhjy6u3jf" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
87+
<iframe width="700" src="https://www.youtube.com/embed/TsWAeWl2T10?si=Z3GzSg2Xhjy6u3jf" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
8888

8989

9090
### Step 4: Controlling the LED Array
@@ -104,7 +104,7 @@ Experiment with other colors by changing the RGB values.
104104

105105
**[VIDEO:] Connect LED:**
106106

107-
<iframe width="560" height="315" src="https://www.youtube.com/embed/l8rRLvF6X6g?si=w-AXCYUHzXj2p1m5" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
107+
<iframe width="700" src="https://www.youtube.com/embed/l8rRLvF6X6g?si=w-AXCYUHzXj2p1m5" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
108108

109109

110110

@@ -169,7 +169,7 @@ This setup allows you to navigate through your sample and adjust focus without t
169169

170170
For a visual guide on how to set up the microscope and use the PS4 controller for control, watch the following video:
171171

172-
<iframe width="560" height="315" src="https://www.youtube.com/embed/y06lRu2dsUk?si=hGGhUpTugzL1LZdK" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
172+
<iframe width="700" src="https://www.youtube.com/embed/y06lRu2dsUk?si=hGGhUpTugzL1LZdK" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
173173

174174

175175
This experiment provides a more interactive experience with your microscope, enabling smooth, hands-free control of the imaging process using a PS4 controller. You can continue to experiment with different settings, such as motor speeds and LED illumination patterns, to optimize your microscope for various samples.
@@ -327,7 +327,7 @@ This file configures the ESP32 stage, LED control, and the camera for widefield
327327

328328
For a visual guide on how to set up ImSwitch and control the UC2 system, watch the following video:
329329

330-
<iframe width="560" height="315" src="https://www.youtube.com/embed/Iw_Bg9aYe1U?si=VQgLP854Hg29dwxW" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
330+
<iframe width="700" src="https://www.youtube.com/embed/Iw_Bg9aYe1U?si=VQgLP854Hg29dwxW" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
331331

332332

333333
## Further Experiments (coming soon)
Lines changed: 282 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
1+
# openUC2 Xiao AI Microscope hardware control PCB
2+
3+
**Overview:**
4+
5+
This PCB connects a Seeed Studio Xiao ESP32S3 module to the openUC2 modular cube system. It features a range of components for illumination and control of motors or servos, providing an I2C bus for integration with the UC2 ecosystem. The board is primarily designed for controlling a motorized system such as peristaltic pumps and driving Neopixel LEDs, with additional support for PWM-driven components and touch inputs.
6+
7+
![](./IMAGES/xiao-insert-with-illumination/capture-2024-10-16T18_45_33.539Z.png)
8+
9+
### **Components:**
10+
11+
1. **Microcontroller:**
12+
- **Seeed Studio Xiao ESP32S3**: A small ESP32-based microcontroller module, mounted via header sockets. The microcontroller is responsible for handling the firmware (UC2-ESP) and communicating with the peripherals.
13+
14+
2. **Power:**
15+
- Powered via **5V** input from the Xiao USB port, with a power distribution setup across the board.
16+
- **Voltage regulators and capacitors** (such as 100uF, 16V) ensure stable power to the motors and peripherals.
17+
18+
3. **Neopixel LED:**
19+
- **WS2812B Neopixel** mounted on the PCB, connected to the Xiao (TX/A6 pin).
20+
- **Optional extension connector** for additional Neopixels, allowing external LED strips or panels to be driven.
21+
- A **cuttable solder jumper** disables the onboard Neopixel if needed.
22+
23+
4. **Touch Buttons:**
24+
- Two **touch-sensitive fields** are connected to specific GPIO pins (marked TOUCH_1 and TOUCH_2).
25+
- These buttons allow for interactive input, triggering various functions (e.g., illumination control or motor activation) via the UC2-ESP firmware.
26+
27+
5. **Motor Drivers:**
28+
- **Two DRV8837C H-bridge motor drivers** are included on the board, providing control for two DC motors or a peristaltic pump.
29+
- Each driver has connections for **IN1, IN2**, and **OUT1, OUT2**, with bulk capacitors (100uF, 16V) ensuring stable operation.
30+
- The motors are powered directly from the 5V system, with a maximum load current of 200mA per driver.
31+
32+
6. **Servo/PWM Ports:**
33+
- **Two servo headers** (3-pin 2.54mm pitch) for connecting servos or other PWM-driven devices.
34+
- Each header provides power, ground, and a PWM signal from the Xiao, supporting standard 9g servos or similar devices.
35+
- Dedicated **servo PWM pins** are used to send signals to the connected servos.
36+
37+
7. **I2C Interface:**
38+
- **I2C headers (J701, J702)** provide connections for the UC2 bus system, enabling the integration of additional peripherals (such as sensors or other cubes).
39+
- **I2C pull-up resistors (2.2kΩ)** are included onboard, with optional solder jumpers for enabling or disabling these pull-ups.
40+
41+
### **Key Connections:**
42+
43+
1. **Microcontroller:**
44+
- Pin PA4_A1_D1: Connects to motor driver IN1.
45+
- Pin PA5_A2_D2: Connects to motor driver IN2.
46+
- Pin PB08_TX: Connects to Neopixel DIN for LED control.
47+
- I2C_SDA (PA8_A4) and I2C_SCL (PA9_A5) pins are connected to the I2C bus for external communication.
48+
49+
2. **Peripherals:**
50+
- Neopixel connected to **TX/A6** of Xiao.
51+
- **Touch inputs** connected to dedicated pins on the Xiao.
52+
- **Motor drivers** controlled via IN1 and IN2 lines from the Xiao, providing forward/reverse motor control.
53+
- **Servo connectors** provide power and PWM signals to connected servos.
54+
55+
### **Power Management:**
56+
- **5V input** powers the Xiao and is distributed to the other components, with onboard voltage regulation.
57+
- Capacitance to handle high inrush current (max. 470uF).
58+
59+
### **Firmware Integration:**
60+
- The board runs on the UC2-ESP firmware, leveraging the ESP32S3's capabilities to control motors, Neopixel LEDs, and servos while communicating over I2C.
61+
- Firmware includes support for both **manual control** via touch inputs and **automated sequences** for driving motors and lighting.
62+
63+
### **Usage Notes:**
64+
- Ensure all components are connected before powering the system via USB.
65+
- The onboard Neopixel can be extended by attaching an external strip to the **Neopixel Extend** port.
66+
- For higher power requirements, ensure adequate power supply via the USB connection.
67+
68+
This PCB design provides a versatile platform for integrating the Seeed Xiao ESP32S3 into the UC2 modular system, enabling advanced control of motors, servos, and lighting, with seamless integration into the UC2 bus system.
69+
70+
## Mounting inside a cube
71+
72+
It gets as easy as placing the PCB inside a cube. Et voila:
73+
74+
![](./IMAGES/xiao-insert-with-illumination/IMG_20241016_152830.jpg)
75+
76+
## Schematics
77+
78+
![](./IMAGES/xiao-insert-with-illumination/xiao-insert-with-illumination-1.png)
79+
80+
![](./IMAGES/xiao-insert-with-illumination/xiao-insert-with-illumination-2.png)
81+
82+
![](./IMAGES/xiao-insert-with-illumination/xiao-insert-with-illumination-3.png)
83+
84+
![](./IMAGES/xiao-insert-with-illumination/xiao-insert-with-illumination-4.png)
85+
86+
![](./IMAGES/xiao-insert-with-illumination/xiao-insert-with-illumination-5.png)
87+
88+
![](./IMAGES/xiao-insert-with-illumination/xiao-insert-with-illumination-6.png)
89+
90+
![](./IMAGES/xiao-insert-with-illumination/xiao-insert-with-illumination-6.png)
91+
92+
93+
## Pin Table
94+
95+
96+
| **ESP32S3 Pin** | **PCB Port/Component** | **Function** |
97+
|------------------------|-------------------------------------------|-------------------------------------------|
98+
| **PA02 (A0/D0)** | Motor Driver 1 (IN1) | Motor control (Input 1) |
99+
| **PA04 (A1/D1)** | Motor Driver 1 (IN2) | Motor control (Input 2) |
100+
| **PA10 (A2/D2)** | Motor Driver 2 (IN1) | Motor control (Input 1) |
101+
| **PA11 (A3/D3)** | Motor Driver 2 (IN2) | Motor control (Input 2) |
102+
| **PA08 (A4/D4/SDA)** | I2C SDA | I2C Data Line |
103+
| **PA09 (A5/D5/SCL)** | I2C SCL | I2C Clock Line |
104+
| **PB08 (A6/TX)** | Neopixel LED (DIN) | Neopixel Data Line |
105+
| **PB09 (D7/RX)** | Neopixel Extend (DIN) | Extension for external Neopixel LED |
106+
| **PA05 (A9/D9/MISO)** | Touch Button 1 (TP103) | Touch input 1 |
107+
| **PA06 (A10/D10/MOSI)** | Touch Button 2 (TP104) | Touch input 2 |
108+
| **PA07 (A8/D8/SCK)** | Servo Connector 1 (PWM) | PWM signal for Servo 1 |
109+
| **PA11 (D3)** | Servo Connector 2 (PWM) | PWM signal for Servo 2 |
110+
| **3.3V** | Power Supply | Powers Xiao and connected components |
111+
| **5V** | Power Supply (Neopixel and Motor Drivers)| Powers high-power components like motors |
112+
| **GND** | Ground | Common ground for all components |
113+
114+
## Sample Programm for the Arduino IDE
115+
116+
Here’s a simple Arduino sketch for the ESP32S3 on the Seeed Studio Xiao module. This sketch will test the Neopixel LED, motor drivers, touch buttons, servos, and I2C functionality on the PCB. You need the required libraries installed (`Adafruit_NeoPixel`, `Wire` for `I2C`, and `ESP_Servo` for servo control). The sketch assumes the UC2-ESP firmware isn't running.
117+
118+
```cpp
119+
#include <Adafruit_NeoPixel.h>
120+
#include <Wire.h>
121+
#include <ESP32Servo.h> // ESP32-specific servo library
122+
123+
// Pin definitions for Xiao ESP32S3 (using D1, D2, etc.)
124+
#define NEOPIXEL_PIN D6 // Neopixel data pin (TX)
125+
#define TOUCH_PIN_1 D1 // Touch Button 1 (GPIO1)
126+
#define TOUCH_PIN_2 D2 // Touch Button 2 (GPIO2)
127+
#define MOTOR_1_IN1 D0 // Motor 1 IN1 (GPIO0)
128+
#define MOTOR_1_IN2 D9 // Motor 1 IN2 (GPIO9)
129+
#define MOTOR_2_IN1 D10 // Motor 2 IN1 (GPIO10)
130+
#define MOTOR_2_IN2 D3 // Motor 2 IN2 (GPIO3)
131+
#define I2C_SDA D4 // I2C SDA (GPIO4)
132+
#define I2C_SCL D5 // I2C SCL (GPIO5)
133+
#define SERVO_PIN_1 D8 // Servo 1 PWM (GPIO8)
134+
#define SERVO_PIN_2 D11 // Servo 2 PWM (GPIO11)
135+
136+
// Motor driver setup
137+
#define MOTOR_SPEED 255 // Max PWM value for motors
138+
139+
// Neopixel setup
140+
#define NUMPIXELS 1 // Number of neopixels
141+
Adafruit_NeoPixel neopixel(NUMPIXELS, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);
142+
143+
// Servo setup
144+
Servo servo1;
145+
Servo servo2;
146+
147+
// I2C test address
148+
const int i2cAddress = 0x3C; // Example I2C address (adjust for your setup)
149+
150+
// Test variables
151+
int touchState1 = 0;
152+
int touchState2 = 0;
153+
154+
void setup() {
155+
// Initialize Serial for debugging
156+
Serial.begin(115200);
157+
158+
// Initialize Neopixel
159+
neopixel.begin();
160+
neopixel.setBrightness(50); // Adjust brightness (0-255)
161+
162+
// Initialize touch pins
163+
pinMode(TOUCH_PIN_1, INPUT);
164+
pinMode(TOUCH_PIN_2, INPUT);
165+
166+
// Initialize motor pins
167+
pinMode(MOTOR_1_IN1, OUTPUT);
168+
pinMode(MOTOR_1_IN2, OUTPUT);
169+
pinMode(MOTOR_2_IN1, OUTPUT);
170+
pinMode(MOTOR_2_IN2, OUTPUT);
171+
172+
// Initialize I2C
173+
Wire.begin(I2C_SDA, I2C_SCL);
174+
175+
// Initialize servos
176+
servo1.attach(SERVO_PIN_1);
177+
servo2.attach(SERVO_PIN_2);
178+
}
179+
180+
void loop() {
181+
// Test Neopixel LED
182+
neopixelTest();
183+
184+
// Test Touch Buttons
185+
touchTest();
186+
187+
// Test Motor Drivers
188+
motorTest();
189+
190+
// Test Servo Motors
191+
servoTest();
192+
193+
// Test I2C Communication
194+
i2cTest();
195+
196+
delay(2000); // Wait 2 seconds before the next test cycle
197+
}
198+
199+
// Neopixel Test: Cycles through colors
200+
void neopixelTest() {
201+
Serial.println("Testing Neopixel...");
202+
neopixel.setPixelColor(0, neopixel.Color(255, 0, 0)); // Red
203+
neopixel.show();
204+
delay(500);
205+
neopixel.setPixelColor(0, neopixel.Color(0, 255, 0)); // Green
206+
neopixel.show();
207+
delay(500);
208+
neopixel.setPixelColor(0, neopixel.Color(0, 0, 255)); // Blue
209+
neopixel.show();
210+
delay(500);
211+
}
212+
213+
// Touch Button Test: Reads touch inputs
214+
void touchTest() {
215+
touchState1 = digitalRead(TOUCH_PIN_1);
216+
touchState2 = digitalRead(TOUCH_PIN_2);
217+
218+
Serial.print("Touch Button 1: ");
219+
Serial.println(touchState1);
220+
Serial.print("Touch Button 2: ");
221+
Serial.println(touchState2);
222+
}
223+
224+
// Motor Test: Drives both motors forward and backward
225+
void motorTest() {
226+
Serial.println("Testing Motor 1...");
227+
// Motor 1 Forward
228+
digitalWrite(MOTOR_1_IN1, HIGH);
229+
digitalWrite(MOTOR_1_IN2, LOW);
230+
delay(1000);
231+
// Motor 1 Backward
232+
digitalWrite(MOTOR_1_IN1, LOW);
233+
digitalWrite(MOTOR_1_IN2, HIGH);
234+
delay(1000);
235+
236+
Serial.println("Testing Motor 2...");
237+
// Motor 2 Forward
238+
digitalWrite(MOTOR_2_IN1, HIGH);
239+
digitalWrite(MOTOR_2_IN2, LOW);
240+
delay(1000);
241+
// Motor 2 Backward
242+
digitalWrite(MOTOR_2_IN1, LOW);
243+
digitalWrite(MOTOR_2_IN2, HIGH);
244+
delay(1000);
245+
246+
// Stop both motors
247+
digitalWrite(MOTOR_1_IN1, LOW);
248+
digitalWrite(MOTOR_1_IN2, LOW);
249+
digitalWrite(MOTOR_2_IN1, LOW);
250+
digitalWrite(MOTOR_2_IN2, LOW);
251+
}
252+
253+
// Servo Test: Sweep both servos back and forth
254+
void servoTest() {
255+
Serial.println("Testing Servos...");
256+
for (int pos = 0; pos <= 180; pos++) {
257+
servo1.write(pos);
258+
servo2.write(pos);
259+
delay(15); // Wait for the servo to reach the position
260+
}
261+
for (int pos = 180; pos >= 0; pos--) {
262+
servo1.write(pos);
263+
servo2.write(pos);
264+
delay(15);
265+
}
266+
}
267+
268+
// I2C Test: Scans for I2C devices
269+
void i2cTest() {
270+
Serial.println("Scanning for I2C devices...");
271+
Wire.beginTransmission(i2cAddress);
272+
if (Wire.endTransmission() == 0) {
273+
Serial.println("I2C device found.");
274+
} else {
275+
Serial.println("No I2C device found.");
276+
}
277+
}
278+
```
279+
280+
## Troubleshoot
281+
282+
If you have any questions, please feel free to reach out to us using the Forum: openuc2.discourse.group.
2.05 MB
Loading
640 KB
Loading
183 KB
Loading
102 KB
Loading
65.1 KB
Loading
65.5 KB
Loading
57.2 KB
Loading
56.8 KB
Loading

0 commit comments

Comments
 (0)