In this tutorial we will learn how to use the seeduino Xiao with the compass I2C sensor QMC5883 and the OLED Display. We will Display all the axis and the temperature on the OLED Display.
Watch the video!
Step 1: What You Will Need
- Seeeduino XIAO
- Compass QMC5883/GY-271 Sensor
- OLED Display
- Breadboard
- Jumper Wires
- Visuino program: Download Visuino
Step 2: About Seeeduino XIAO
- Powerful CPU: ARM® Cortex®-M0+ 32bit 48MHz microcontroller(SAMD21G18) with 256KB Flash,32KB SRAM
- Flexible compatibility: Compatible with Visuino & Arduino IDE
- Easy project operation: Breadboard-friendly
- Small size: As small as a thumb(20×17.5mm) for wearable devices and small projects.
- Multiple development interfaces: 11 digital/analog pins, 10 PWM Pins, 1 DAC output, 1 SWD Bonding pad interface, 1 I2C interface, 1 UART interface, 1 SPI
interface.Typical Application
- Wearable devices
- Rapid prototyping (directly attached to the expanded PCB as a minimal system)Perfect for all the projects need mini Arduino
- DIY keyboard
- USB development (USB to multi-channel TTL/USB host mode, etc.)
- A scenario where you need to read multiple mock values The DAC output
Step 3: The Circuit
- Connect XIAO pin [5V] to Compass sensor pin [VCC]
- Connect XIAO pin [GND] to Compass sensor pin [GND]
- Connect XIAO SCL pin [5] to Compass sensor pin [SCL]
- Connect XIAO SDA pin [4] to Compass sensor pin [SDA]
- Connect XIAO pin [5V] to OLED Display pin [VCC]
- Connect XIAO pin [GND] to OLED Display pin [GND]
- Connect XIAO SCL pin [5] to OLED Display pin [SCL]
- Connect XIAO SDA pin [4] to OLED Display pin [SDA]
Step 4: Start Visuino, and Select the Seeeduino XIAO Board Type
The Visuino: https://www.visuino.eu also needs to be installed. Download Free version or register for a Free Trial.
Start Visuino as shown in the first picture Click on the “Tools” button on the Arduino component (Picture 1) in Visuino When the dialog appears, select “Seeeduino XIAO” as shown on Picture 2
Step 5: In Visuino Add & Set Components
- Add “Compass QMC5883/GY-271” component
- Add “OLED I2C Display” component
- Double click on the “DisplayOLED1” and in the “Elements” window drag 4X “Draw Text” to the left side and 4X “Text Field” to the left side.
- In the “Elements” window select “Draw Text1” and in the properties window set “Text” to X
- In the “Elements” window select “Draw Text2” and in the properties window set “Text” to Y, and “Y” to 20
- In the “Elements” window select “Draw Text3” and in the properties window set “Text” to Z, and “Y” to 40
- In the “Elements” window select “Draw Text4” and in the properties window set “Text” to TEMP and “Y” to 55
- In the “Elements” window select “Text Field1” and in the properties window set “X” to 20
- In the “Elements” window select “Text Field2” and in the properties window set “X” to 20 and “Y” to 20
- In the “Elements” window select “Text Field3” and in the properties window set “X” to 20 and “Y” to 40
- In the “Elements” window select “Text Field4” and in the properties window set “X” to 50 and “Y” to 55
Close the “Elements” window.
Step 6: In Visuino Connect Components
- Connect “Compass1” pin [X] to “DisplayOLED1” pin [Text Field1 In]
- Connect “Compass1” pin [Y] to “DisplayOLED1” pin [Text Field2 In]
- Connect “Compass1” pin [Z] to “DisplayOLED1” pin [Text Field3 In]
- Connect “Compass1” pin [Thermometer] to “DisplayOLED1” pin [Text Field4 In]
- Connect “Compass1” pin [I2C Out] to XIAO board pin [I2C In]
- Connect “DisplayOLED1” pin [I2C Out] to XIAO board pin [I2C In]
Step 7: Generate, Compile, and Upload the Arduino Code
In Visuino, at the bottom click on the “Build” Tab, make sure the correct port is selected, then click on the “Compile/Build and Upload” button.
Step 8: Play
If you power the Seeeduino XIAO module, the OLED Display will start to show the sensor Values.
Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Tutorial, you can download it and open it in Visuino: https://www.visuino.eu
Download XIAO-COMPASS.zip