Categories
Hardware

Grove – 12 Key Capacitive I2C Touch Sensor

The Grove – 12 Key Capacitive I2C Touch Sensor V3 (MPR121) is a multi-channel proximity capacitive touch sensorIt’s a 3-in-1 module with the following features: Capacitance Sensing. Tough Sensing.

  •  Internal 10-bit ADC
  •  Integrated independent autocalibration for each electrode input
  •  Completely independent electrodes with built-in autoconfiguration
  •  I2C interface, with IRQ, Interrupt output to advise electrode status changes
  •  Hardware configurable I2C address
  • 12 electrodes/capacitance sensing inputs in which 8 are multifunctional for LED driving and GPIO
  • Autoconfiguration of charge current and charge time for each electrode input
  • Separate touch and release trip thresholds for each electrode, providing hysteresis and electrode independence
  • Add two more GND pin and expand the gap of pins for safe handling

More information:
https://www.seeedstudio.com/Grove-12-Key-Capacitive-I2C-Touch-Sensor-V3-MPR121-p-4694.html

Categories
Hardware

Coral System-on-Module

The Coral System-on-Module (SoM) is a fully-integrated system that helps you build embedded devices that demand fast machine learning (ML) inferencing. It contains NXP’s iMX 8M system-on-chip (SoC), eMMC memory, LPDDR4 RAM, Wi-Fi, and Bluetooth, but its unique power comes from Google’s Edge TPU coprocessor for high-speed machine learning inferencing.

  • NXP i.MX 8M SoC
    • Quad-core ARM Cortex-A53, plus Cortex-M4F
    • 2D/3D Vivante GC7000 Lite GPU and VPU
  • Google Edge TPU ML accelerator
  • Cryptographic coprocessor
  • Wi-Fi 2×2 MIMO (802.11b/g/n/ac 2.4/5 GHz)
  • Bluetooth 4.2
  • 8GB eMMC
  • 4GB LPDDR4
  • USB 3.0
  • Gigabit Ethernet
  • HDMI and MIPI-DSI
  • MIPI-CSI-2
  • Up to 95x GPIO (including SPI, I2C, PWM, UART, SAI, and SDIO)

More information:
https://www.seeedstudio.com/Coral-4GB-SOM-Version-p-4685.html

Categories
Tutorial

Temperature Sensor Box

Simple DS18B20 based temperature sensor appliance with open source 3D printable box and prototype PCB.

The box and the prototype PCB is optional, only one ESP8266 based MCU is needed and one DS18B20 temperature sensor. I suggest to you a WEMOS D1 mini, but this example works with an ESP-01 as well.

This example does not explain how to write and upload an Arduino program to the ESP8266 MCU, so be aware of this skill before following me. 🙂

Supplies

  1. ESP8266 MCU (recommended WEMOS D1 mini)
  2. DS18B20
  3. 4.7 kΩ resistor
  4. some wire
  5. optionally prototype PCB for WEMOS D1 mini
  6. optionally 3D printed box

Step 1

It’s easy as pie, check the wiring schematics on the picture:

  • In case of bare ESP8266 board, connect the RX and TX to your USB-serial device, in case of any board with integrated USB this is not necessary.
  • Connect the GND and VCC to the ESP8266 board and to the DS18B20 sensor.
  • Connect the resistor between the VCC and the data wire of the DS18B20 sensor.
  • Connect the data wire of the DS18B20 sensor to one GPIO of the MCU (for example GPIO 2).

Step 2

You need three additional library:
– OneWire: one-wire
– DallasTemperature: dallas-temperature
– The IoT Guru Integration: the-iot-guru-integration

Step 3

The IoT Guru cloud is a free cloud backend, you can use it to save and show measurements really easy. You need to create a device, a node and a field:

To connect with the cloud, you need to gather five identifier:

  • userShortId: the short identifier of you
  • deviceShortId: the short identifier of your device
  • deviceKey: the secret key of your device
  • nodeShortId: the short identifier of your device
  • fieldName: the name of the field

Step 4

Here is the example code, you need to replace the identifiers to your identifier, replace the SSID and the password to your WiFi credentials and check the GPIO number of the DS18B20 data wire.

#include <OneWire.h>
#include <DallasTemperature.h>

#include <IoTGuru.h>
#include <ESP8266WiFi.h>

const char* ssid      = "iotguru.cloud";
const char* password  = "********";

String userShortId    = "l4jLDUDDVKNNzx4wt2UR6Q";
String deviceShortId  = "uAjbSzf8LvlrofvwYU8R6g";
String deviceKey      = "hacfIjPn6KbBf2md8nxNeg";
IoTGuru iotGuru = IoTGuru(userShortId, deviceShortId, deviceKey);

String nodeKey        = "tGib1WSRvEGJ98rQYU8R6g";
String fieldName      = "temperature";

#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

void setup(void)
{
    Serial.begin(115200);
    delay(10);

    WiFi.begin(ssid, password);
    while (WiFi.status() != WL_CONNECTED) {
        delay(50);
        Serial.print(".");
    }
    Serial.println("");

    iotGuru.setCheckDuration(60000);
    iotGuru.setDebugPrinter(&Serial);

    sensors.begin();
}

void loop(void)
{
    iotGuru.check();
    sensors.requestTemperatures();

    float measuredValue = sensors.getTempCByIndex(0);
    Serial.println("The first sensor temperature: " + String(measuredValue) + " °C");
  
    iotGuru.sendHttpValue(nodeKey, fieldName, measuredValue);

    delay(30000);      
}

Step 5

Upload the compiled firmware to your device. If everything is fine, your thermometer box will send the sensor measurements to the cloud and you’ll see such nice graphs over time if enough measurements have accumulated.

More information and examples:

Categories
Hardware

CANBed FD – Arduino

This CANBed-FD adopts MCP2517FD CAN Bus controller with SPI interface and MCP2542FD CAN transceiver to achieve the CAN-BUS capability. With an OBD-II converter cable added on and the OBD-II library imported, you are ready to build an onboard diagnostic device.

  • Compact size (56x41mm)
  • Work at CAN-FD and CAN 2.0
  • Industrial standard 9 pin sub-D connector or 4-pin terminal
  • OBD-II and CAN standard pinout selectable at sub-D connector
  • 2 x 4-Pin Grove connectors compatible with the Grove ecosystem
  • SPI Interface up to 10 MHz
  • Wide power input range from 7-28V

More information:
https://www.seeedstudio.com/CANBed-FD-Arduino-CAN-FD-Development-Kit-p-4724.html

Categories
Tutorial

ArduinoIDE integration

Step 1

To install The IoT Guru integration into your Arduino IDE you can use the Library Manager (available from IDE version 1.6.2). Open the IDE and click to the Sketch menu and then Include Library > Manage Libraries.

Step 2

Then the Library Manager will open and you will find a list of libraries that are already installed or ready for installation. In order to install The IoT Guru integration, search for “The IoT Guru integration“, scroll the list to find it and click on it.

Finally click on install and wait for the IDE to install The IoT Guru integration. Downloading may take time depending on your connection speed. Once it has finished, an Installed tag should appear next to the The IoT Guru integration library. You can close the Library Manager.

Step 3

You can now find The IoT Guru integration available in the Sketch > Include Library menu.

Step 4

We included some examples to our library, so that you can choose various examples to integrate your devices with our services, for example the basic device connection:

That’s all, folks! 🙂

Categories
Hardware

High Quality Camera for Raspberry Pi

This high-quality camera is equipped with an IMX477 12.3MP high quality camera module which adopts the IMX477R sensor. It supports CS-mount lenses by default, but however, a C-CS adapter is included in order to use C mount lenses as well with this camera. It is compatible with Raspberry Pi Compute Module 3, 3 Lite, 3+, 3+ Lite, and NVIDIA Jetson Nano. This offers a higher resolution (12.3MP) and higher sensitivity (nearly 50% greater area per pixel for improved low-light performance) than the traditional 8MP IMX219 cameras.

  • Sony IMX477 sensor with 12.3MP for high resolution 
  • Greater pixel area for improved low-light performance
  • Back-illuminated sensor architecture for improved sensitivity
  • Supports a wide range of C and CS-mount lenses
  • Integrated back-focus adjustment ring

More information:
https://www.seeedstudio.com/High-Quality-Camera-For-Raspberry-Pi-Compute-Module-Jetson-Nano-p-4729.html

Categories
Hardware Tutorial

Raspberry Pi health monitoring

This tutorial will show you how to use IoT Guru Cloud to monitor the health of your Raspberry Pi and alert you when something is wrong.

At the end of this tutorial, you will run a Python script every five minutes using crontab to send your Raspberry Pi’s temperature, free disk space and memory usage to the cloud using our REST API.

Step 1

First of all, we suggest to read our basic tutorials about devices, nodes and fields:

Step 2

Create a device of your Raspberry Pi, create a node of this device, and name it as ‘Health’, and create three fields like this:

Step 3

Copy the node key of the ‘Health’ node (by click ‘Show the key’ button).

Step 4

Create a raspi_health.py file with your favorite editor and copy-paste this code below. Don’t forget to replace the nodeKey value with your node key!

import os
import ssl
import re
import subprocess
import urllib.request

# Replace with your nodeKey:
nodeKey = 'meg1rJ98goXrS7QnAcBMfw'

# DO NOT EDIT BELOW, unless you trust yourself

cpu_temp_endpoint  = 'https://api.iotguru.cloud/measurement/create/' + nodeKey + '/cputemp/'
disk_free_endpoint = 'https://api.iotguru.cloud/measurement/create/' + nodeKey + '/diskfree/'
mem_usage_endpoint = 'https://api.iotguru.cloud/measurement/create/' + nodeKey + '/memusage/'

#!/usr/bin/env python3

def getRAMinfo():
    p = os.popen('free')
    i = 0
    while 1:
        i = i + 1
        line = p.readline()
        if i==2:
            RAM_stats = line.split()[1:4]
            RAM_total = int(RAM_stats[0])
            RAM_free = int(RAM_stats[2])
            RAM_freeperc = int(RAM_free / RAM_total * 100)
            return RAM_freeperc

def postData(endpoint, value):
    gcontext = ssl.SSLContext()
    url = endpoint + str(value)
    req = urllib.request.Request(url)
    resp = urllib.request.urlopen(req, context=gcontext)
    respData = resp.read()
    print(respData)

cputemp = subprocess.Popen('cat /sys/class/thermal/thermal_zone0/temp', shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8')
cputemp = int(int(cputemp) / 1000)
postData(cpu_temp_endpoint, cputemp)

usedspace = subprocess.Popen('df --output=pcent / | awk -F\'%\' \'NR==2{print $1}\'', shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8')
freespace = 100 - int(usedspace)
postData(disk_free_endpoint, freespace)

freeram = getRAMinfo()
postData(mem_usage_endpoint, freeram)

Step 5

Test the script in the command line, you will get something like this:

> python3 raspi_health.py
b'{"epoch":18567,"nodeId":"f1cf3da0-1c34-11eb-be3c-3f829e309568","nodeShortId":"vjw_gp4wlWjxzz2gHDQR6w","field":"cputemp","created":"4eb38920-1c37-11eb-be3c-3f829e309568","floatValue":32.0,"textValue":null}'
b'{"epoch":18567,"nodeId":"f1cf3da0-1c34-11eb-be3c-3f829e309568","nodeShortId":"vjw_gp4wlWjxzz2gHDQR6w","field":"diskfree","created":"4ed9d5d0-1c37-11eb-b075-c16b57e52174","floatValue":16.0,"textValue":null}'
b'{"epoch":18567,"nodeId":"f1cf3da0-1c34-11eb-be3c-3f829e309568","nodeShortId":"vjw_gp4wlWjxzz2gHDQR6w","field":"memusage","created":"4f113980-1c37-11eb-be3c-3f829e309568","floatValue":44.0,"textValue":null}'

Step 6

Add the script to the end of your crontab, by using the crontab -e command:

*/5 * * * * python3 /home/pi/raspi_health.py > /dev/null 2>&1

Step 7

Check out the chart of one of your field:

That’s all, folks, enjoy your charts of your Raspberry Pi. 🙂

Based on Jasonb’s forum post: tutorial-monitor-health-of-your-raspberry-pi

Thank you, Jason! 🙂

Categories
Hardware

Raspberry Pi Compute Module 4 IO Board

Exposing every interface from Raspberry Pi Compute Module 4, the Compute Module 4 IO Board provides a development platform and reference base-board design.

  • External power connector (+12V, +5V)
  • 2 x full-size HDMI 2.0 connectors
  • 2 x USB 2.0 connectors, with header for two additional connectors
  • Gigabit Ethernet RJ45 with PoE support
  • Micro USB socket for updating Compute Module 4
  • MicroSD card socket for Compute Module 4 Lite (without eMMC) variants
  • PCIe Gen 2 x1 socket
  • Standard fan connector
  • 2 x MIPI DSI display FPC connectors (22-pin 0.5 mm pitch cable)
  • 2 x MIPI CSI-2 camera FPC connectors (22-pin 0.5 mm pitch cable)
  • Standard Raspberry Pi HAT connectors
  • Real-time clock with battery socket and ability to wake Compute Module 4
  • Various jumpers to disable specific features, e.g. wireless connectivity, EEPROM writing

More information:
https://www.raspberrypi.org/products/compute-module-4-io-board/

Categories
Hardware

Seeeduino XIAO

Seeeduino XIAO is the smallest Arduino compatible board in Seeeduino Family. It is an Arduino microcontroller that is embedded with the SAMD21 microchip. The interfaces of Seeeduino XIAO is rich enough in such a tiny Dev. Board as well.

  • Powerful CPU: ARM® Cortex®-M0+ 32bit 48MHz microcontroller(SAMD21G18) with 256KB Flash,32KB SRAM
  • Flexible compatibility: Compatible with 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.

More information:
https://www.seeedstudio.com/Seeeduino-XIAO-Arduino-Microcontroller-SAMD21-Cortex-M0+-p-4426.html

Categories
Example

Complex chart example

Display daily, weekly, monthly and yearly charts of the (in source) specified nodes and fields with auto-refresh feature on your website.

HTML source

https://github.com/IoTGuruLive/web-api-examples/blob/master/complex-chart.html

Live demo

https://iotgurulive.github.io/web-api-examples/complex-chart.html