Introduction: Intel Galileo Gen 2 Light Sensor With Seed Studio Starter Kit

Here I'm going to show you how to create a simple Intel Galileo Gen2 Project with a light sensor and an LCD display.

Basically when there is light the display is supposed to Display "There is Light" and "Doing Stuff". The "Doing Stuff" part is left to you,you can hook up a servo,fan...etc but as of now it'll just light up an LED.

Let's Get Started.

SET UP

Hardware

  1. Intel Galileo Gen 2
  2. Seedstudio Base Shield
  3. Grove OLED
  4. Groove Light Sensor
  5. Grove Chainable RGB LED

These sensors can be ootained from the Seedstudio Starter Kit here . The image accompanying this step is the basic set of hardware required.

Software

  1. Atmel Studio.

You can also use the good old Arduino IDE.

Let's check out the assembly next...


Step 1: Assembly

The assembly is pretty simple...

  1. Attach the Seed studio base shield on to the ICSP SCK pins of the Galileo Gen 2.
  2. Attach the LED to the Base shield D3 pins
  3. Attach the Light Sensor to the D7 pins of the Base shield
  4. Attach the LCD or OLED to one of the I2C pins of the base shields.

I'd recommend using the connectors that come with the Starter Kit,they are pretty convenient to say the least.

Next ,power your Galileo by connecting it to a power source and hook a USB cable to your Galileo via a USB cable client on the board.

Next we code...

Step 2: The Base Shield

Grove - Base Shield is the new version of Electronic Brick Shield.The Basic Shield is compatible with Seeeduino v2.21 (168p and 328p), and Arduino UNO and Duemilanove. We standardize all the connectors into 4 pins(Signal 1,Signal 2,VCC and GND) 2mm connectors, which simplify the wiring of electronics projects. The 4pins buckled connectors also make the wiring a snap. We built many different kinds of Grove to match up with Base Shield, and if you have existing Electronic Brick modules, you don't have to worry about compatibility--we have various converter cables that address compatibility between these two systems. This is very similar to an Arduino shield, and of course, can be used with our Seeeduino or Mega board, as well as other Arduino-compatible boards. In v1.0b, we move in the analog connectors slightly so that it will clear the higher power connector and USB connector.

The purpose of the Grove - base shield is to allow easy connection of any microprocessor input and output pins to the small units. Each socket is clearly labeled with its matching I/O pin

Step 3: The LED

This new version of LED Grove consists of one green LED. It operates from 5V DC. Perfect for use on Seeeduino digital outputs, or also can be controlled using pulse-width modulation. Each LED has a current-limiting resistor, which protects the LED and the Arduino from high current.

Step 4: Code

On Atmel Studio...Create a new C/C++ project

You can still simply load the Arduino IDE if Atmel is not your thing...

Code


#include <math.h>
#include <Wire.h>
#include "rgb_lcd.h"
rgb_lcd lcd;
const int colorR = 255; 
const int colorG = 0; 
const int colorB = 0;
const int ledPin=12;                  
const int thresholdvalue=10;           
float Rsensor; 
void setup() {
  
   
 lcd.begin(16, 2);
    
    
lcd.setRGB(colorR, colorG, colorB);
    
    
pinMode(ledPin,OUTPUT);  
    
delay(1000);
} 
void loop() {
  
int sensorValue = analogRead(0); 
  
Rsensor=(float)(1023-sensorValue)*10/sensorValue;
 
 if(Rsensor>thresholdvalue)
  {
    
digitalWrite(ledPin,HIGH);
  }
  
else
  {
  digitalWrite(ledPin,LOW);
  }
  
  
lcd.setCursor(0, 0);
 
 lcd.print("Data: "+sensorValue);
lcd.setCursor(1, 1);
  
lcd.print("Res: "+Rsensor);//Resistance
  
delay(1000);
}