Smart Citizen: Adding sensor (or an actuator) over the expansion port


The Smart Citizen Kit has a built-in expansion port, the Add-on port. This was designed to support I2C sensors or even a slave Arduino board. It can also support Dallas 1-Wire and WS1228. By adding extra accessories we can virtually integrate any sensor as ADC and GPIOs drivers are commonly available as described below.

EXAMPLE: Integrating sensors to the SCK 1.1: The OSBH Smart Citizen Kit

We add two waterproof temperature sensors together with the Ambient Board sensors to measure the temperature inside the beehive.

Since the beehive is located in a remote area we will set the Smart Citizen Kit 1.1 to log on the internal SD Card.

  • 1. We integrated two Waterproof Digital Temperature sensor by Maxim, the DS18B20. These are Dallas 1-Wire sensors with a unique ID assigned by the manufacturer.

  1. We used the expansion port on top of the SCK 1.1 Sensor Board to connect the 2 sensors. The expansion port is designed to expand the sensor board by adding new sensors via the common I2C standard. However other protocols are supported via software as on the following case where we use the Dallas 1-Wire protocol, found in many temperature and humidity sensors.

The pins have the following configuration:

1 - GND - Ground
2 - SCL - I2C (by software: 1-WIRE / WS2812)
3 - SDA - I2C (by software: 1-WIRE / WS2812)
4 - VBAT - Battery Raw Voltage
5 - VCC 3.3V - Stable 3.3V Max 500mA

  • 3. The SCK 1.1 firmware needs to be changed in order to support the sensor.
    i. We integrate the Adafruit Library for the WS2812
    ii. The complete firmware implementation is available here on the SCK 1.1 Repository (The Smart Citizen Kit OSBH Firmware branch
    iii. In the following example we can see how we momentarily disable the I2C (Wire) bus in order to support other protocols as the Dallas 1-Wire of the WS2812 sensor.



uint16_t sckGetExtTemp(){
Wire.end(); // Disable I2C bus on the PIN
delay(100); // Wait for stability
extTemperatures.begin(); // Start the WS2812 sensor.
extTemperatures.getAddress(extTemperatures1, 0); Get the WS2812 address
extTemperatures.requestTemperatures(); // Send WS2812 temp
float extTemp = extTemperatures.getTempC(extTemperatures1); // Store it

#if debuggSCK
Serial.print(“DS18B20 (Ext Sensor): “);
Serial.println(“ C”);

delay(100); // Wait for stability
Wire.begin(); // Enable the I2C bus on the PIN

return (int) extTemp*100; // Return

  • 4. Since the device is storing data onto the internal SD Card no changes are required on the platform.


Discuss this Project on