Skip to the content
2 layers68.6 × 53.3 mmUNO, the printed circuit board in 3D

KiCad files for the shield, Arduino code for the prototype and a description of the dashboard

Size
68.6 × 53.3 mm
Copper layers
2
Thickness
1.6 mm
Parts
22
Nets
45
Pads
80
Tracks, vias
107, 0
Routed
Yes
KiCad
KiCad 5 (file 20171130)
Created
30 Nov 2018
Updated
30 Nov 2018

Overview

UNO is an open-source printed circuit board by MOSH-Insa-Toulouse, from the MOSH-Insa-Toulouse/Rougeaux_Taillardat_KiCad_Arduino repository on GitHub. It is a 2-layer board of 68.6 × 53.3 mm with 22 parts on 45 nets, routed with 107 tracks and 0 vias.

It is built around the LTC1050CP. Its parts include 10 connectors, 5 resistors, 4 capacitors and 3 ICs.

Main components

1

README

README.md

LoRa Project: Smart Gas Sensor

Elie Taillardat & Sophie Rougeaux

Key-words: Arduino KiCad The Thing Network LoRa Node-RED IoT Gas sensor

This project is realised in the 5th year PTP ISS at INSA Toulouse. A LoRa-connected gas sensor has been developed to alert the user about the concentration of health threatening gas near the sensor.

Content

This repository contains :

  • KiCad PCB Files: A shield for the gas sensor to plug on an Arduino Uno (made with KiCad)
  • Arduino Code: The code for the microcontroler (using Arduino IDE)

A Node-RED Dashboard has been done to stay connected with your sensor. The development of this HMI is described at the end of this Readme. (Node-RED and Freeboard.io)

KiCad PCB Files

Overview

The shield is composed of :

  • A home-made gas sensor (made at AIME)
  • An amplifier stage for home-made gas sensor
  • A commercial gas sensor for the calibration of the home-made one (Grove connectors)
  • A LoRa chip for the data transmission
  • A LED as an on/off indicator

We built our own footprints libraries expect for the Arduino Uno component

Schematics

PCB Layout

These parameters have been respected to respect the INSA PCB production capacity :

  • Isolation : 0.4
  • Largeur piste : 0.8
  • Via : 1.6
  • Perçage Via : 0.8

3D Visualization

Arduino Board & Code

We have done a prototype using a Grove gas sensor to measure the gas concentration in the air.

Arduino Board

The elements in this project are :

  • An Arduino Uno
  • A LoRa chip RN2783A
  • A Grove gas sensor (v1.4) MQ-9
  • A LED

Overview of the code

Data from a Grove gas sensor is transmitted with a RN2483A chip, via the LoRa network, to a TTN (The Things Network) account in which the Arduino device is registered. The Arduino listens for incoming messages from a dashboard that is linked with the TTN account and allows the user to switch the gas sensor on and off. A LED switches on and off according to the gas sensor state.

You will find more information about the dashboard in the next section

Libraries

The communication bewteen the Arduino and the RN2483A is serial, so you will need the SoftwareSerial library. Communication with The Things Network is achieved with the very well writtenTheThingsNetwork library.

LoRa setup

To send data to The Things Network, you will need to create an account, register your device, and enter your device IDs in the Arduino code :

c
// Set your AppEUI and AppKey
const char *devAddr = "26011253";
const char *nwkSKey = "D1A126A957FC1C25F20D3DB5379E3DE6";
const char *appSKey = "FC290B61D206CD05073F42CF673DE592";

The, the TTN library provides functions to quickly setup your LoRa chip, like personalize(devAddr, nwkSKey, appSKey);.

Sending sensor values

To send data, the function readAndSend reads the analog data from the sensor and prepares the payload containing the read value in bytes. Then, sendBytes function from TTN is used to transmit the data.

c
void readAndSend() {

  // Read sensor
  int sensorValue = analogRead(sensorPin);
  debugSerial.println(sensorValue);

  // Prepare payload
  byte payload[2];
  payload[0] = sensorValue >> 8;
  payload[1] = sensorValue;

  // Send it off
  ttn.sendBytes(payload, sizeof(payload));
}
Receiving data

The callback function onMessage provided by the TTN library listens for an incoming message (downlink mode in TTN). When a message is received, the message function is called.

If a 0 is received, the LED switches off and we will stop reading the gas sensor values. We will just keep the connection alive:

c
void keepAlive() {

  // Prepare payload (default payload FF)
  byte payload[1];
  payload[0] = 0xFF;

  // Send it off on port 2 to indicate this not a sensor value
  ttn.sendBytes(payload, sizeof(payload), 2);
}

When a 1 is received, we switch on the light and we will start reading the sensor values using the previsouly presented readAndSend function.

Node-Red Dashboard

TTN data payload

Data sent by the Arduino board through LoRa network are decoded thanks to our Decoder function that we precised in the Payload Format section on TTN, which allows to generate an understandable payload with the bytes received, as json format for instance. Our Decoder is presented below:

javascript
function Decoder(bytes, port) {
  // Decode an uplink message from a buffer
  if (port === 2) { // send via the dashboard to stop gas sensor, see next chapter
    return { waiting: true };
    
  } else if (port === 1) {
    var gas = (bytes[0] << 8) | bytes[1];       // value between 0 and 1024
    var nano = (bytes[2] << 8) | bytes[3];
    
    // transform into readable data
    var gas_volt = gas / 1024 * 5.0;
    var gas_ratio = (5.0 - gas_volt)/gas_volt;  // see datasheet for the calculation
    var R0 = 9.3;                               // sensor resistance at 1000ppm LPG in the clean air
    return {
      gas: (gas_ratio/R0).toFixed(2),
      nano: nano
    };
  }
}

We code the nano variable in prevision of the future nano-particules sensor that we will design at AIME). For now it is useless.

And the result for a simulated uplink payload on port 1: 02 BE 01 F5

json
{
  "gas": 7.02,
  "nano": 5.01
}

Node-RED

Once the payload is well interpreted in TTN, we use the tool Node-RED built on Node.js, to deal with our data and then display them in a dashboard for user consultation.

We use a ttn uplink node linked to our application (App ID: 20079652) and registered device (Device ID: arduino_gaz_sensor). When a data is received, we can observe in the debug console the json payload received (output of the debug node, cf. picture above in the right panel). Therefore we received the payload as expected. The dashboard compiled is shown below:

As we can see, we add a switch to control the state of the gas sensor remotely. When switched off for example, the payload sent in the ttn downlink node looks like:

json
{
  "gas_sensor": false,
}

Then our Encoder on TTN sends to the Arduino board a bytes payload 00 or 01 (on port 2 or 3):

javascript
function Encoder(object, port) {
  // Encode downlink messages sent as
  // object to an array or buffer of bytes.
  var bytes = [];
  if (port === 2) bytes[0] = object.gas_sensor ? 1 : 0;
  if (port === 3) bytes[0] = object.nano_sensor ? 2 : 0;

  return bytes;
}

When we simulate this behavior in real time, we can see the expected result on the TTN console output, and the LED switched off on our Arduino board:

Here, we can see that when switched off, the Arduino board stops sending data and is in a waiting mode. Once we switched on, the data are sent and received again.

Freeboard.io

In addition to the localhost Node-RED dashboard we created, we prefered to use also Freeboard.io, to access the interface anywhere, and not only on our laptop localhost (http://127.0.0.1:1880/ui/). That's the aim of the dweet node, which transfers the payload to a specific topic, that we will use in our freeboard dashboard.

Dashboard link: https://freeboard.io/board/Wauqxs

The curve allows the user to interpret the Gas ratio, and obtain a value in ppm of the gas concentration.

Contact

Parts

22
QtyValueFootprintReferences
4CONN_01X01Socket_Arduino_Uno:Arduino_1pinP5, P6, P7, P8
3100nCapacitor_THT:C_Disc_D6.0mm_W2.5mm_P5.00mmC1, C2, C3
2100kResistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P5.08mm_HorizontalR1, R3
21kResistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P5.08mm_HorizontalR2, R6
110kResistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P5.08mm_HorizontalR5
11uCapacitor_THT:C_Disc_D6.0mm_W2.5mm_P5.00mmC4
1AnalogSocket_Arduino_Uno:Socket_Strip_Arduino_1x06P2
1DigitalSocket_Arduino_Uno:Socket_Strip_Arduino_1x10P3
1DigitalSocket_Arduino_Uno:Socket_Strip_Arduino_1x08P4
1Grove_SensorGrove:conn_GroveJ1
1LEDLED:conn_LEDJ2
1LTC1050LTC1050:DIP-8_W7.62mm_LongPadsU2
1PowerSocket_Arduino_Uno:Socket_Strip_Arduino_1x08P1
1RN2483_BreakoutRN2483:Module_RN2483_Breakout_WITHOUTPADSU10
1TO-5-4TO-5-4:TO-5-4U3

Similar boards

  • 2 layers68.6 × 53.3 mmProject kicad, the printed circuit board in 3D

    Project kicad

    MOSH-Insa-Toulouse/2023-2024_4GP_NGO-TRAN

    INSA 4GP MOSH Project - NGO/TRAN

    23 parts1MIT
  • 2 layers75.5 × 65.8 mmProjet capteur, the printed circuit board in 3D

    Projet capteur

    MOSH-Insa-Toulouse/2024-2025-4GP-oetham-axellgp

    Projet Capteur - Mathéo HAHN et Axel LONGEPIERRE

    21 parts1GPL-3.0
  • 2 layers68.6 × 53.8 mmCapteur Graphite, the printed circuit board in 3D

    Capteur Graphite

    Daniel-Mael/2023-2024-4GP-PeralesRios-LeBlanc

    Daniel Perales Rios - Maël Le Blanc

    24 partsGPL-3.0
  • 2 layersKicadTestv1, the printed circuit board in 3D

    KicadTestv1

    eferrandi31/ProjectGasSensor

    18 parts
  • 2 layers165 × 92.5 mmGas Sensor V1, the printed circuit board in 3D

    Gas Sensor V1

    JonathanPleuron/Smart-Devices

    This project was realised in the IoT growing context. It introduces a solution of smart gas sensor using the emerging LoRa technology.

    45 parts
  • 2 layers68.6 × 53.3 mmShield Arduino MOSH, the printed circuit board in 3D

    Shield Arduino MOSH

    Khomat/GIRIBALDI-DUBOIS_MOSH_Project

    The goal of this project is to build a connected gas sensor and build the interface around the sensor.

    23 parts
  • 2 layers68.6 × 57 mmSchield, the printed circuit board in 3D

    Schield

    lm-hotton/ProjetCapteurGraphite2022-LM-TL

    Nous avons également créé un APK Android permettant d'afficher la valeur de la résistance mesurée sur un smartphone.

    22 parts
  • 2 layers68.6 × 53.3 mmCapteur Graphite, the printed circuit board in 3D

    Capteur Graphite

    LucaPaccard/INSA_ProjetCapteur

    L'ensemble des étapes menées pour réaliser ce capteur, en allant du design jusqu'à la réalisation en passant par le codage seront détaillées dans ce dossier.

    22 parts

Questions

How big is the UNO PCB?

It measures 68.6 × 53.3 mm and has 2 copper layers, 1.6 mm thick.

What parts does the UNO use?

22 parts, built around the LTC1050CP. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the UNO KiCad files?

From the MOSH-Insa-Toulouse/Rougeaux_Taillardat_KiCad_Arduino repository on GitHub, at the commit this page was made from: the board is KiCad_PCB_files/UNO/UNO.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.

Can I use the UNO design in my own project?

Its repository states no licence, so its author keeps all rights: ask MOSH-Insa-Toulouse before reusing the design.