Introduction

Gravity: I/O Expansion Shield for OpenMV Cam M7 is an expansion shield specially designed for the OpenMV Cam M7. It is compatible with various sensors and electronic modules of Gravity Series, plug and play, no soldering required. It not only helps you avoid the complex wiring , welding and other operations, but also helps you quickly complete wiring and get started with the sensors or electronic modules, to build prototypes faster.

This expansion shield is equipped with a 5V external power supply port and a 3.3V/VIN power switch, which makes the expansion shield able to drive high current components such as motors and servos. There are 9 sets of digital ports, 1 set of analog port, 1 set of serial port and 2 sets of I2C ports on the expansion shield. Additional, there is an onboard 3.3V LDO, which meets the power demand of multiple modules at the same time.

1.The USB port of the expansion shield is only used for power supply, so it cannot be used for programming or debugging. The continuous current of the USB port is recommended to be controlled within 1A.
2.When put the expansion shield on the OpenMV motherboard, please pay attention to the direction. The USB port of the expansion shield should be on the same side as the USB port of the OpenMV motherboard.
3.Because OpenMV motherboard works at 3.3V, limited by the voltage, it does not support 5V analog input. All signal pins are 0~3.3V.
4.If you need to drive high current components such as servos and motors, please connect them to P7~P9 ports, then connect the external power supply, and turn the power switch to VIN side. Otherwise, the OpenMV motherboard may be damaged due to high current.
5.The power supply of P7,P8,P9 port can be selected 3.3V or VIN by the power switch. The power supply voltage of the remaining ports are all 3.3V.

Specification

Board Overview

Num Label Description
1 Digital Port connect to Gravity series digital modules
power supply voltage of the port:3.3V
Pin:P0~P5
2 Power Switch choose the power supply voltage of P7,P8,P9 ports, 3.3V or VIN(external power supply)
3 Reset Button reset the OpenMV
4 Digital Port
(High Current)
drive high current components such as motors and servos
power supply voltage of the port: 3.3V or VIN (can be selected by the power switch)
Pin:P7,P8,P9
5 UART Port connect to Gravity series UART modules
power supply voltage of the port:3.3V
Pin:P0,P1(UART 1)
6 External Power Port connect to the external power supply
input voltage:5V
7 Analog Port connect to Gravity series analog modules
power supply voltage of the port:3.3V
Pin:P6
8 I2C Port connect to Gravity series I2C modules
power supply voltage of the port:3.3V
Pin:P4,P5(I2C 2)

Insertion Direction

When put the expansion shield on the OpenMV motherboard, please pay attention to the direction. The USB port of the expansion shield should be on the same side as the USB port of the OpenMV motherboard.

Tutorial

This tutorial shows how to use this expansion shield in 2 cases. The first case takes the Gravity: Analog Sound Sensor as an example to demonstrate the basic wiring operation, and then reads the analog value through the OpenMV motherboard to obtain the sound value. In the second case, the 9g Metal Gear Micro Servo is used as an example to demonstrate the usage of the external power supply and the power switch, then the rotation of the servo is controlled by the OpenMV motherboard. At present, we have written a software library of 10 commonly used sensors or modules, click to open the link.

Requirements

Case 1:Analog Sound Sensor

Connection Diagram

As shown below,connect the sensor to the P6 port of the expansion shield.
Openmv_sound_wire.jpg

Sample Code

# Analog sound sensor is used to measure the sound.
# Hardware : analog sound sensor, OpenMV
# connect:
#     Sensor    OpenMV
#     VCC       3V3
#     GND       GND
#     data      P6
from pyb import ADC,Pin
import time
adc=ADC(Pin('P6'))  # Must always be "P6".
while True:
  val=adc.read()    # Read the analog value
  print(val)
  time.sleep(100)

Expected Result

Copy the sample code in the OpenMV IDE and click the start button. As shown in the picture below, when there is sound, the value will increase significantly.

Openmv_sound_result.jpg

Case 2:Analog Servo(PPM)

Connection Diagram

As shown below,connect the servo to the P7 port of the expansion shield.

The external power supply must be connected to the USB port of the expansion shield! The power switch must be turned to the VIN side.

Sample Code

# Servo Control Example
# This example shows how to use your OpenMV Cam to control servos.
# Hardware : Servo, OpenMV
# connect:
#     Servo    OpenMV
#     VCC       5V
#     GND       GND
#     data      P7
import time
from pyb import Servo,Pin
s1 = Servo(1) # P7
while(True):
    s1.angle(0)
    time.sleep(1000)
    s1.angle(90)
    time.sleep(1000)
    s1.angle(0)
    time.sleep(1000)
    s1.angle(-90)
    time.sleep(1000)

Expected Result

Copy the sample code in the OpenMV IDE and click the start button, you will see the servo constantly spinning.

FAQ

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents

OpenMV Pinout
OpenMV Website
OpenMV Reference Documentation
Gravity Library for OpenMV(github)

DFshopping_car1.png Get Gravity I/O Expansion Shield for OpenMV Cam M7 from DFRobot Store or DFRobot Distributor.

Turn to the Top