The Edge ML kit provides a number of accessories that can be used with your Particle Photon 2 device. While the parts in the kit can be used with other Particle devices, the Edge ML features will only work on the P2 and Photon 2 at this time because of the limited amount of flash and RAM on older devices.
Your kit may be labeled Edge AI, and it has the same contents as described here.
This breakout board allows you to detect motion and orientation. Using Edge ML you can filter for certain types of motion. It can also be used for wake-on-motion to wake from sleep.
The connections on the breakout are:
|Any available GPIO if using interrupt 1 (optional)
|Any available GPIO if using interrupt 2 (optional)
|SPI Chip Select. Use any available GPIO (required)
|SPI MISO (required)
|SPI MOSI (required)
|SPI SDK (required). Not I2C SCL (D1)!
Use the ADXL362DMA library, or other compatible library. The library includes the full API definitions, as well as example code for getting raw accelerometer data and for doing simple orientation calculation.
This breakout board is a digital microphone. It's intended for voice applications, not high-fidelity recording. Using Edge ML you cam implement similar voice commands using the microphone. It can also be used to detect specific sounds, such as an alarm siren.
There are machine learning tutorials using this microphone on the machine learning page.
The connections on the breakout are:
|Typically leave unconnected, left/right select
Use the Microphone_PDM library. The library can be used for RTL872x (P2, Photon 2) and nRF52 (Boron, B Series SoM, Tracker SoM, Argon). It does not support Gen 2 devices (Electron, E Series, Photon, P1). The library includes sample code for capturing audio samples and additional information.
On the nRF52 you can use other GPIO for PDM clock and data, but using A0 and A1 will assure compatibility with the Photon 2.
The vibration sensor a simple digital output that detects motion. This is simpler to use than the accelerometer, but less flexible. It is a two-terminal device that looks like an electrolytic capacitor.
We recommend that you connect one terminal to 3V3 and the other to an available GPIO, typically a
D pin but an
A pin can also be used.
Set the pin mode, for example if using
To read the vibration status, use:
bool vibrating = (digitalRead(D2) == HIGH);
- Max voltage: 12V
- Max current: 50mA
- Conductive time: ~2ms
- Closed resistance <10 ohm
- Open resistance: >10M ohm
- Operating temperature range: -40 to 80 C
- Pull force of terminal: 500gf for 1 min
- Operating lifespan: up to 200,000 cycles
- Dimensions (excluding pin): 4.77mm (0.19in) diameter x 11.18mm (0.44in) length
- Dimensions (including pin): 21.5mm (0.85") length
- Weight: 0.22g (.008oz)
This sensor measures distance, and provides an analog output that is proportional to distance that you can connect to an
A pin and use
analogRead() to read. Note that this sensor requires 5V so you cannot use it when powered by a LiPo battery but it will work when connected to USB. The analog output is a maximum of 3V so it's safe to connect to an analog input, which supports a maximum of 3.3V.
The sensor has 5 output pins, but the red and black (power) lines are duplicated.
The white wire should be connected to an available analog input (
Note that the analog value is inverse from the voltage, and not linear. See the datasheet for more information.
- Distance measuring range: 100cm to 550cm
- Supply voltage: 4.5V to 5.5V
- Operating current: 30 mA
- Sensor datasheet
The loudness sensor provides an analog output that is proportional to the loudness. This is easier to use than the microphone, but of course only detects that there is sound, not its specific characteristics. This sensor requires 3.6V minimum, so it's best to use it powered by VUSB, but this means that you will not be able to use it when powered by a LiPo battery.
Care should be used when setting the adjustable gain - if you set it to maximum gain and it is very loud, the output could exceed the recommended maximum of 3.3V on analog inputs.
The breakout includes a Grove connector to flying leads cable. It's also possible to use a 4-pin Grove-to-Grove cable if you have a board with a Grove connector and a Grove Feather Adapter.
|Connect to an analog input pin
This is a sensor for detecting the presence of various combustible gasses. It requires 5V so you cannot use it when powered by a LiPo battery but it will work when connected to USB. Also, this type of sensor has a small heater inside, which is not well suited for being battery powered.
The potentiometer determines the threshold for the digital output.
You don't need to connect both D0 and A0, you can use just one of them.
- D0 can be connected to any digital (
D) or analog (
A) input on your Particle device.
- A0 can be connected to any analog (
A) input on your Particle device.
When reading the analog input, low concentration of gas will result in values closer to 0. Values closer to 4095 (the maximum) indicate high levels of detectable gasses. By using the analog output, you can adjust the sensitivity in software.
The potentiometer controls the gas level level that switches D0 on and off.
There are also other members of the MQ sensor family (not included in this kit):
- MQ3 alcohol vapor
- MQ5 LP gas and natural gas
- MQ9 Carbon monoxide
This sensor detects heat using a passive infrared (PIR) sensor. It's typically used to sense humans (and other warm-blooded animals). It requires 5V so you cannot use it when powered by a LiPo battery but it will work when connected to USB. The output is only 3.3V so it's safe to connect to any available GPIO.
|5V power (when powered by USB)
|Connect to any available GPIO
Several light-emitting diodes (LEDs) are included in the kit, and can be used as indicator lights. The LEDs in your kit may vary slightly from the items pictured here.
LEDs require a current limiting resistor. Typically you will use 1KΩ (Brown - Black - Red - Gold) so the LED will not be overly bright.
You can use 330 Ω (Orange - Orange - Brown - Gold) if you need maximum brightness. This will require changing the pin drive strength on nRF52840 devices (Boron, B Series SoM, Tracker, E404X, Argon) in software.
- The longer lead is the positive connection or anode
- The shorter lead in the negative connection or cathode. The case may also have a flattened spot on the cathode side.
- The current limiting resistor can be on either the positive or negative side, but there must be a separate current limiting resistor for each LED if you have more than one.
Instead of the LEDs above, your kit may include different LEDs:
- IR LED (blue-ish)
- White LED (clear with rounded top)
- Red LED (included with most kits that contain a photo transistor instead of the white LED to reduce confusion)
- Photo transistor (clear and flat on top)
Resistors have a standardized color code.
The resistors in the kit include:
|Orange - Orange - Brown - Gold
|LED current limiting
|Brown - Black - Red - Gold
|Transistor gate or current limiting
|Brown - Black - Orange - Gold
|Pull-up or pull-down
The kit contains a standard USB-A to Micro-B cable. You can use any USB cable, but for programming over USB make sure you are using a full USB data cable and not a "charging only" cable.
The kit contains a solderless breadboard.
Electrically, the holes in a solderless breadboard are connected like this:
Source: Wikipedia, Florian Schäffer, License: CC BY-SA 4.0
We recommend that you use:
- Red for 3V3 (3.3V power)
- Black for GND (ground)