Make your own free website on

Arduino Entesla SensIO Shield Programming

SensIO is a sensor and I/O shield for Arduino and compatible boards. It has an on-board RGB LED, Light Dependent Resistor (LDR),IR proximity sensor pair for measuring distance from an obstacle in close proximity, a Potentiometer as analog Input, a Temperature Sensor, a Buzzer, a Push Button for digital inputs and a 3-axis MMA7455 accelerometer for Motion sensing along all the three axis.

This sensor shield is ideal for sensing and interacting with real-world physical parameters like light, temperature, sound and motion.

Here is the Arduino Uno Code to go along with Entesla SensIO Shield.


Arduino Entesla SensIO Shield Prototyping,V2.0. Nitin William 01/01/2014

Wire.h Library from

MMA_7455 Library, Moritz Kemper, IAD Physical Computing Lab moritz.kemper@zhdk. ch ZHdK, 20/11/2011

This example code is in public domain.



#include <Wire.h>// Include the Wire library

#include <MMA_7455.h>// Include the MMA_7455 library

#include <Button.h>// Include the Button library

const byte ledPin = 13;// Select the pin for the On Board LED

const byte redPin = 11;// Select the pin for RGB

const byte greenPin = 10;// Select the pin for RGB

const byte bluePin = 9;// Select the pin for RGB

const byte buttonPin1 = 12;// Select pin for Button1

const byte buttonPin2 = 8;// Select pin for Button2

const byte buttonPin3 = 7;// Select pin for Button3

const byte buttonPin4 = 4;// Select pin for Button4

const byte buzzerPin = 6;// Select pin for Pizzeo buzzer

const byte tempPin = A0;// LM35 pin

const byte ldrPin = A1;// Select the input pin for LDR

const byte irPin = A2;// Select the input pin for IR Obstacle detector

const byte potPin = A3;// Select the input pin for Potentiometer

const float alpha = 0.5; // Constant for LPF

char xLPF, yLPF, zLPF;// Variable of filtered x,y,z values from MMA 7455

char xVal, yVal, zVal; //Variables for the values from the sensor

int lux;// Define variable for light intensity

int irSense;// Define variable to store IR reading

int timer1_counter;// Timer1 counter

int heatValue;// Define variable to store LM35 reading

int potValue;// Variable to store the value coming from the sensor

float tempC;// Temperature reading

float voltageRead;// Define variable to store ADC reading

float roll;// Define variable to store roll

float pitch;// Define variable to store pitch

MMA_7455 accSensor = MMA_7455();// Make an instance of MMA_7455

Button button1 = Button (buttonPin1, PULLUP);// Create Button Object as input with internal pullup resistors

Button button2 = Button (buttonPin2, PULLUP);// Create Button Object as input with internal pullup resistors

Button button3 = Button (buttonPin3, PULLUP);// Create Button Object as input with internal pullup resistors

Button button4 = Button (buttonPin4, PULLUP);// Create Button Object as input with internal pullup resistors

void setup()


noInterrupts();// Disable interrupts

pinMode(ledPin, OUTPUT);// Declare On Board LED as an output

pinMode(buzzerPin, OUTPUT);// Declare Buzzer as an output

pinMode(redPin, OUTPUT);// Delcare Red LED as an output

pinMode(greenPin, OUTPUT);// Delcare Green LED as an output

pinMode(bluePin, OUTPUT);// Delcare Blue LED as an output

pinMode(potPin, INPUT);// Declare Pot pin as input

pinMode(tempPin, INPUT);// Delcare LM35 pin as input

pinMode(ldrPin, INPUT);// Declare LDR as an input

pinMode(irPin, INPUT);// Declare IR as an input */

interrupts();// Enable all interrupts

accSensor.initSensitivity(2);// Set the sensitivity you want to use, 2 = 2g, 4 = 4g, 8 = 8g

accSensor.calibrateOffset(17,31,0);// Calibrate to read 0,0,64 when board is horizontal and at rest

Serial.begin(9600);// Initialize serial communications at 9600 bps

Serial.println("Arduino UNO R3...Running(16Mhz)");// Display Arduino

Serial.println("With Entesla SensIO Shield - De VU3GAO");// Display SensIO


void loop()


for (int i=0; i <= 500; i++)


sensIO ();

if (button1.uniquePress()) buttonpress ();// Test button 1

if (button2.uniquePress()) buttonpress ();// Test button 2

if (button3.uniquePress()) buttonpress ();// Test button 3

if (button4.uniquePress()) buttonpress ();// Test button 4

if (irSense > 600 ) alarm ();// Read ir Diode


Serial.println ("Dumping Sensor Status on Serial RS232 link ");// Display message

Serial.print ("Measured Voltage (V):");// Display lable

Serial.println (voltageRead);// Display measured volts

Serial.print ("Measured Temperature (Deg C):");// Display lable

Serial.println (tempC);// Display temperature

Serial.print("Roll (Deg):");



Serial.print("Pitch (Deg):");


switch (lux)


case 0:



case 1:



case 2:




if (tempC < 20.00 )


digitalWrite (redPin, HIGH);

digitalWrite (greenPin, HIGH);

digitalWrite (bluePin, LOW);


if ((tempC > 20.00) && (tempC < 30.00))


digitalWrite (redPin, HIGH);

digitalWrite (greenPin, LOW);

digitalWrite (bluePin, HIGH);


if (tempC > 30.00)


digitalWrite (redPin, LOW);

digitalWrite (greenPin, HIGH);

digitalWrite (bluePin, HIGH);



void sensIO ()


potValue = analogRead(potPin);// Read Pot

heatValue = analogRead(tempPin);// Read LM35M

lux = map(analogRead(ldrPin), 0, 700, 0, 2);// Read LDR, map value between 0-2

tempC = heatValue*(500.0/1024.0);// Convert to Deg Celcius

voltageRead = potValue*(5.0/1024.0);// Compute Voltage from ADC Reading

irSense = analogRead(irPin);// Read IR proximity sensor

xVal = accSensor.readAxis('x'); //Read out the 'x' Axis

yVal = accSensor.readAxis('y'); //Read out the 'y' Axis

zVal = accSensor.readAxis('z'); //Read out the 'z' Axis

xLPF = xVal * alpha + (xLPF * (1.0 - alpha));// Low Pass Filter

yLPF = yVal * alpha + (yLPF * (1.0 - alpha));// Low Pass Filter

zLPF = zVal * alpha + (zLPF * (1.0 - alpha));// Low Pass Filter

roll = (atan2(-xLPF,zLPF)*180.0)/M_PI;// Calculate roll in degrees

pitch = (atan2(-yLPF,zLPF)*180.0)/M_PI;// Calculate pitch in degrees


void alarm ()


digitalWrite(buzzerPin, HIGH);

digitalWrite(redPin, LOW);


digitalWrite(redPin, HIGH);

digitalWrite(buzzerPin, LOW);


void buttonpress ()


digitalWrite(ledPin, HIGH);

delay (50);

digitalWrite(ledPin, LOW);