Load CDS sensor type values into DB by calling server API [P001]


 



 

https://www.youtube.com/watch?v=KGXxDDacQb4


*GitHubhttps://github.com/rdiot/rdiot-p001.git

 

* Contents

- API Call and Save the CDS Values to the API Server.

 

- Result
2391 S001       ArduinoUno   W5100         Ethernet     MiniPhotocell       2015-10-08 00:22:34 F01                  513 0~1023           
2392 S002       ArduinoUno   W5100         Ethernet     PhotoResistorModule 2015-10-08 00:22:36 F01                  343 0~1023           
2393 S003       ArduinoUno   W5100         Ethernet     CDS5MM               2015-10-08 00:22:37 F01                 829 0~1023           
2394 S004       ArduinoUno   W5100         Ethernet     CDS10MM             2015-10-08 00:22:38 F01                  702 0~1023           
2395 S005       ArduinoUno   W5100         Ethernet     CDS15MM             2015-10-08 00:22:39 F01                  957 0~1023           
2396 S006       ArduinoUno   W5100         Ethernet     CDS20MM             2015-10-08 00:22:41 F01                  959 0~1023           

 

- Key Code
#include <SPI.h>
#include <Ethernet.h>

/* --------------------------------------------------------------------
*  Ethernet Config
* -------------------------------------------------------------------*/
byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 }; //MAC Address
char server[] = "54.65.30.222"; //API Server
String s_data1 = ""; // Request Data
int led_green = 6; // Connect LED ON
int led_red = 7; // DisConnect LED ON


EthernetClient client;

connect_server();

 s_data1 = "sensor_id=S001&";
 s_data1 += "sensor_board=ArduinoUno&";
 s_data1 += "sensor_shield=W5100&";
 s_data1 += "sensor_comm=Ethernet&";
 s_data1 += "sensor_name=MiniPhotocell&";
 s_data1 += "sensor_func=F01&";
 s_data1 += "sensor_value=" + (String)analogRead(A0) + "&";
 s_data1 += "sensor_value_desc=0~1023";
 Serial.println("S001-"+ (String)analogRead(A0));


if (client.connected())
 {
  Serial.println("c1");
  client.println("POST /iotHome-api/v1/sensor/post-form2xml-mysqldb HTTP/1.0");
  client.println("Host: 54.65.30.222");
  client.println("User-Agent: Arduino");
  client.println("Connection: close");
  client.println("Content-Type: application/x-www-form-urlencoded");
  client.print("Content-Length: ");
  client.println(s_data1.length());
  client.println();
  client.println(s_data1);

  digitalWrite(led_green, HIGH);
  delay(100);
  digitalWrite(led_green, LOW);
 }
 else
 {
  digitalWrite(led_red, HIGH);
  delay(1000);
  digitalWrite(led_red, LOW);
 }
 delay(1000);

Posted by RDIoT
|

Auto On Off Photo Switch (AS-10-220) [S157]

 

 

 

https://www.youtube.com/watch?v=8xIMZTtYBdg

* Specs
To turn on or off the light in day and night without manual operation
Do not install the control unit in a place extremely darker in daytime or a place directly by lighting of turning - ON lamp
Widely used: street light, highway, factories, garden, ports, airports, farm, parks, schools, and other places. Also can fit into solar lamps and lanterns, or cars, motorcycles, electric cars and other power supply voltage is 220V lamps and lanterns or equipment
Easy to install and Convenient to use
Model:AS-10-220
Input Voltage: DC or AC 220V
Max Load Current: 10A
Size:(approx)5 x 4.2 x3.5cm/1.96"x1.65"x1.37"
Frequency:50-60Hz

 

* Contents
AC Auto On/Off Test

 

- Connect
Black - LINE
White - NEUT
Red - LOAD

Posted by RDIoT
|

BH1750 Digital Light intensity Sensor Module (GY-302) [S085]

 

 

https://www.youtube.com/watch?v=oekWwsUYKuE


*GitHub https://github.com/rdiot/rdiot-s085.git

* Specs
Model: GY-302
Chip: BH1750FVI
Power supply :3-5V
Data output range resembles luminance from 0-65535 lux
I2C Interface
No external parts required
Dimensions: 13.9mm X 18.5mm

 

* Contents
- DataSheet : http://rohmfs.rohm.com/en/products/databook/datasheet/ic/sensor/light/bh1750fvi-e.pdf
- Library : https://github.com/claws/BH1750

- Connect
VCC ----- 5V(3.3V)
GND ----- GND
SCL ----- A5
SDA ----- A4
ADD ------ X

- Key Code
#include <BH1750.h>
BH1750 lightMeter;
lightMeter.begin();
uint16_t lux = lightMeter.readLightLevel();
lcd.print("Light=" + (String)lux + " lx   ");

Posted by RDIoT
|

Photo Resistor Module (KY-018) [S002]


 

https://www.youtube.com/watch?v=EKLfcRSVAVc


*GitHubhttps://github.com/rdiot/rdiot-s002.git

 

* Specs
Photoresistors are semiconductor photosensitive devices,
in addition to having high sensitivity, fast response, consistent with the spectral characteristics and value of good features, but at a high temperature, and humidity in harsh environments, but also to maintain
a high degree of stability and reliability, wide pan used cameras, solar garden lights, lawn, detectors, clock, music, cups, gift boxes, mini-Night light, light voice switches, lights automatically switch toys and a variety of light control, light control lighting, lamps and other light automatic opening OFF control field


* Contents
- Connect
S - A1
middle - 5V
- GND

 

- Key Code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
 
LiquidCrystal_I2C lcd(0x27,20,4);  // LCD2004
 
int sensorPin1 = A0;
int sensorPin2 = A1; //S002
 
void setup()
{
  lcd.init();  // initialize the lcd
  lcd.backlight();
  lcd.print("start LCD2004");
}
 
void loop()
{
  int rate1 = analogRead(sensorPin1);
  int rate2 = analogRead(sensorPin2);

  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("[1]CDS05MM=" + (String)rate1);
  lcd.setCursor(0,1);
  lcd.print("[2]KY-018=" + (String)rate2);
 
  delay(200);
}

Posted by RDIoT
|

Mini Photocell (FIT0180) [S001]

 

 

https://www.youtube.com/watch?v=LAcLVWYBJbY


*GitHubhttps://github.com/rdiot/rdiot-s001.git

 


* Specs
Head Diameter:              5mm
Voltage:                    5V 
Power Consumption:          70mW
Operating Temperature:      -25~+85
Storage Temperature:        -40~+100
Soldering Temperature:      260(<3s)

 

* Contents
- Connect
Short ----- 5V
Long  ----- P10K ----- GND

 

- Key Code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

 

LiquidCrystal_I2C lcd(0x27,20,4);  // LCD2004

 

int sensorPin = A0;

 

void setup()
{
  lcd.init();  // initialize the lcd
  lcd.backlight();
  lcd.print("start LCD2004");
}

 

void loop()
{
  int rate = analogRead(sensorPin);

  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("S001:FIT0180");
  lcd.setCursor(0,1);
  lcd.print("CDS Value=" + (String)rate);
 
  delay(200);
}

Posted by RDIoT
|

CDS5MM~CDS20MM Value [S003~S006]



https://www.youtube.com/watch?v=660-OrdtU4E


*GitHubhttps://github.com/rdiot/rdiot-s003.git


* Contents

- Connect

A0, A1, A2, A3


- Key Code

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd(0x27,20,4);  // LCD2004


int sensorPin1 = A0;

int sensorPin2 = A1;

int sensorPin3 = A2;

int sensorPin4 = A3;


void setup()

{

  lcd.init();  // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD2004");

}


void loop()

{

  int rate1 = analogRead(sensorPin1);

  int rate2 = analogRead(sensorPin2);

  int rate3 = analogRead(sensorPin3);

  int rate4 = analogRead(sensorPin4);


  lcd.clear();

  lcd.setCursor(0,0);

  lcd.print("[1]CDS05MM=" + (String)rate1);

  lcd.setCursor(0,1);

  lcd.print("[2]CDS10MM=" + (String)rate2);

  lcd.setCursor(0,2);

  lcd.print("[3]CDS15MM=" + (String)rate3);

  lcd.setCursor(0,3);

  lcd.print("[4]CDS20MM=" + (String)rate4);


  delay(200);

}


Posted by RDIoT
|