'Arduino'에 해당되는 글 103건

  1. 2018.01.16 NRF24L01 2.4Ghz Wireless Module (NRF24L01) [S275]
  2. 2018.01.10 nRF905 Wireless Module 433,868,915Mhz (NRF905) [S117]
  3. 2017.11.29 MQTT + Kafka + Raspberry Pi ElasticSearch Cluster [P016]
  4. 2017.10.24 MQTT + Kafka + Amazon ElasticSearch Service [P015]
  5. 2017.09.27 ARTIK MQTT + Raspberry Pi Apache Kafka Cluster Bridge [P014]
  6. 2017.09.24 Crash Collision Sensor Detection Module [S230]
  7. 2017.09.03 SunFounder RAB 5 in 1 Breadboard [B193]
  8. 2017.05.24 Call server API for multiple sensor information [P002]
  9. 2017.05.24 Air Quality Sensor Measurement RGB Matrix Output [P004] 1
  10. 2017.03.03 UVC Camera Movie Monitoring [P006]
  11. 2017.02.22 L9110 Fan Module (L9110) [D086]
  12. 2017.02.15 Arduino MQTT Client & ARTIK MQTT Broker [P012]
  13. 2016.12.13 WeMos D1 Wifi Uno ESP8266 esp-12e [B175]
  14. 2016.10.05 WeMos D1 mini 0.66 inch 64x48 OLED Shield [D056]
  15. 2016.10.05 65K Color OLED 0.95 SPI 96x64 (SSD1331) [D058]
  16. 2016.10.05 OLED 0.96 I2C 128x64 White (SSD1306) [D044]
  17. 2016.10.05 OLED 0.96 I2C 128x64 (SSD1306) [D003]
  18. 2016.10.05 OLED 0.91 I2C 128x32 White (SSD1306) [D054]
  19. 2016.10.05 8-Digit 7 Segment Module (MAX7219) [D066]
  20. 2016.10.05 4 Digit Tube LED Display Module (TM1637) [D014]
  21. 2016.10.05 7Segment 4 Digit LED Module (5461AS) [D013]
  22. 2016.10.05 DZ292 Laser Receiver Module (DZ292) [S035]
  23. 2016.10.05 650nm Laser Diode Module (KY-008) [D004]
  24. 2016.10.05 L9110S 2-Channel Dual Motor Driver (L9110S) [B042]
  25. 2016.10.05 ULN2003 Stepper Motor driver (X113647) [B002]
  26. 2016.10.05 Control H Bidge Gear Motor Control [P003]
  27. 2016.10.05 L298N Dual Motor Driver H Bridge (L298N) [B005]
  28. 2016.10.05 100RPM Gear Motor [S141]
  29. 2016.10.05 TT Motor Car Gear Motor [S142]
  30. 2016.10.04 Clamp Gripper Bracket Servo Mount [B045]

NRF24L01 2.4Ghz Wireless Module (NRF24L01) [S275]






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


GitHub : https://github.com/rdiot/rdiot-s275.git


* Specs

nRF24L01 is a single chip radio transceiver for the world wide 2.4 - 2.5 GHz ISM band. 

The transceiver consists of a fully integrated frequency synthesizer, a power amplifier, a crystal oscillator, a demodulator, modulator and Enhanced ShockBurst? protocol engine. 

Output power, frequency channels, and protocol setup are easily. 

programmable through a SPI interface. 

Current consumption is very low, only 9.0mA at an output power of -6dBm and 12.3mA in RX mode. 

Built-in Power Down and Standby modes makes power saving easily realizable. 

Maximum operating speeds up to 2Mbps, GFSK modulation efficiency, Anti-interference ability, Particularly suitable for industrial control applications. 

125 Communications channels, Multi-point communication and frequency hopping to meet the communication needs. 

Built-in hardware CRC error detection, Multipoint communication address control. 

Low-power 1.9 ~ 3.6V, only 1uA on Power down mode. 

Built-in 2.4Ghz antenna. 

Available software to set the address, only received local Address when output data(Provide interrupt instruction), can be directly connected to a variety of microcontrollers, Software programming is very convenient. 

Support 6 Data channels of data reception. 

Standard DIP Pitch Interface for embedded applications. 


* Contents

- Connect 


VCC - 3.3V

CSN - D8

MOSI - D11

IRQ - NONE

GND - GND

CE - D7

SCK - D13

MISO - D12


- parts

Rotary Encoder Module (KY-040) [S120]


- Library : https://github.com/nRF24/RF24

- Tested Library Download : RF24-master.zip



- Key Code

- RF24_TX : https://github.com/rdiot/rdiot-s275/blob/master/RF24_TX.ino

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>

#include <SPI.h>

#include <nRF24L01.h>

#include <RF24.h>


LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x20 for a 16 chars and 2 line display


RF24 radio(7, 8); // SPI Bus CE, CSN 

const byte address[6] = "00001"; // RX = TX same address

int pin = A0; // Rotary Encoder Module (KY-040) [S120] : http://rdiot.tistory.com/126 [RDIoT Demo]


void setup() {

  pinMode(pin, INPUT);

  

  Serial.begin(9600);

  

  radio.begin();

  radio.openWritingPipe(address);

  radio.setPALevel(RF24_PA_MIN); // Power Level : accoding to distance : RF24_PA_MIN / RF24_PA_LOW / RF24_PA_HIGH / RF24_PA_MAX


  radio.stopListening();  // TX 


  lcd.init(); // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD1602");

  delay(1000);

  lcd.clear();

    

}


void loop() {

  lcd.setCursor(0,0);

  lcd.print("S275:RF24L01 TX");

  

  int readVal = analogRead(pin);

  readVal = map(readVal, 0, 1023, 0, 179);

  Serial.println(readVal);


  lcd.setCursor(0, 1);

  lcd.print("msg=>" + String(readVal) + "  ");

   

  char buf[4];

  itoa(readVal, buf, 10);

    

  radio.write(&buf, sizeof(buf)); //send messages to RX 

  delay(10);

  

}


- RX24_RX : https://github.com/rdiot/rdiot-s275/blob/master/RF24_RX.ino

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>

#include <SPI.h> 

#include <nRF24L01.h>

#include <RF24.h>

#include <Servo.h> 


LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x20 for a 16 chars and 2 line display


RF24 radio(7, 8); // SPI Bus CE, CSN 

const byte address[6] = "00001"; // TX = RX same address


Servo myservo; 

int servoPin = 4; 


void setup() {


  Serial.begin(9600);

  

  radio.begin();

  radio.openReadingPipe(0, address);

  radio.setPALevel(RF24_PA_MIN); // Power Level : accoding to distance : RF24_PA_MIN / RF24_PA_LOW / RF24_PA_HIGH / RF24_PA_MAX


  radio.startListening(); // RX


  myservo.attach(servoPin); 


  lcd.init(); // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD1602");

  delay(1000);

  lcd.clear();

 

}


void loop() {

  lcd.setCursor(0,0);

  lcd.print("S275:RF24L01 RX");


  lcd.setCursor(0, 1);

  if (radio.available()) {    

    char text[4] = "";

    

    radio.read(&text, sizeof(text));

    Serial.println(text);

    

    lcd.print("rcv=>" + String(text) + "     ");


    int value = atoi(text);

     myservo.write(180-value);

  }


  delay(10);

  

}


- how to debug radio details 

#include <printf.h>


  printf_begin();

  radio.printDetails();





Posted by RDIoT
|

nRF905 Wireless Module 433,868,915Mhz (NRF905) [S117]



 


 

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


GitHubhttps://github.com/rdiot/rdiot-s117.git


* Specs

Tri-band transceiver operating frequency for the international ISM band 433/868/915MHz GMSK modulation, anti-interference ability, especially for industrial control applications using the DSS + PLL frequency synthesizer technology, excellent frequency stability, high sensitivity, to achieve - 100dBm low operating voltage (2.7V), low power consumption, standby only 1uA maximum transmit power of +10 dBm with multiple channels (up to more than 170) meet the requirements for low-power devices, in particular, to meet the needs of multi-channel work of special occasions, the work rate up to 76.8 Kbps

External components of at least (10), the basic need to debug. Low transmit power and high receive sensitivity of the design, the use of the license required to apply for open use at distances up to 1000m and the specific use of the environment and component parameters.


Electrical Characteristics:

NRF905 work band: 433/868/915MHz

Channel number: 170

Function: transmitter / receiver

Frequency stabilization method: PLL

Modulation mode: the FSK / GMSK

Maximum output power: +10 dBm

Sensitivity:-100dBm

Maximum operating rate: 76.8Kbit / s

Working voltage :2.7 - 3 .3 V


Application areas:

Vehicle monitoring, remote control, telemetry, small wireless network, wireless meter reading, access control systems, residential paging, industrial data acquisition systems, wireless tags, identification, non-contact RF smart cards, small wireless data terminals, security, fire systems, wireless remote control system, bio-signal acquisition, hydrological and meteorological monitoring, robot control, wireless 232 data communications, wireless 485/422 data communications, digital audio, digital image transmission.


* Contents

 

 

 

- Connect

VCC ---- Power supply.
TXE ---- RF module mode selecting.
CE ---- Enable RF module for transmit and receive.
PWR ---- Power up chip.
CLK ---- Output clock, divided crystal oscillator full swing clock.
CD ---- Carrier detect.
AM ---- Address matched.
DR ---- Receive and transmit ready.
MISO ---- SPI master input slave output.
MOSI ---- SPI mater output slave input.
SCK ---- SPI clock.
CSN ---- SPI enable.
GND ---- Ground
GND ---- Ground

 

- KOR : 919.7Mhz, 921.7Mhz, 923.1Mhz


- Reference Source : http://www.electrodragon.com/wp-content/uploads/2011/11/NRF905-for-arduino.zip

 

- Changed Code Library

PROGMEM unsigned const int freq_tab[10] = {
 

- TX Source : https://github.com/rdiot/rdiot-s117/blob/master/nRF905_TX.ino

#include <NRF905.h>
#include <SPI.h>

#define BUF_LEN          32
#define CONF_LEN         10

#define NRF905_CSN       10

unsigned char tx_buf[BUF_LEN]= "RDIoT TX CNT:  \r\n";
unsigned char read_config_buf[CONF_LEN];

byte tx_address[4]= {0xcc,0xcc,0xcc,0xcc};

void setup()
{
    unsigned char i;
   
    pinMode(NRF905_CSN,OUTPUT); //to make sure SPI works
   
    nrf905=NRF905(NRF905_CSN);
   
    nrf905.init();


    /**
        default configuration, need to specify frequency
        choose Z-Wave frequency band, support :
        US  908.42Mhz
        EUROPE  868.42MHz
        AFRICA  868.42MHz
        CHINA  868.42MHz
        HK  919.82MHz
        JAPAN  853.42MHz
        AUSTRALIA 921.42MHz
        NEW_ZEALAND 921.42MHz
        BRASIL  921.42MHz
        RUSSIA  896MHz
    */
    nrf905.write_config(US);
 
 
    nrf905.read_config(read_config_buf);

    Serial.begin(9600);

    for(i=0; i<10; i++)
    {
        Serial.print(read_config_buf[i],HEX);
        Serial.print(' ');
    }
   
    tx_buf[12] = '0';
}

void loop()
{
    /** transmit data packet with default TX Address */
    nrf905.TX(tx_buf);
   
    /** transmit data packet with specified TX Address */
//    nrf905.TX(tx_buf, tx_address);
   
    // NOTE: TX_Address and RX_Address must be the same
   
    /** Count Sending times */
    tx_buf[12]++;
    if(tx_buf[12] == 0x3A){
      tx_buf[12] = '0';
    }
    delay(50);
}

 


 

- RX Source : https://github.com/rdiot/rdiot-s117/blob/master/nRF905_RX.ino

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

#include <NRF905.h>
#include <SPI.h>
#define BUF_LEN          32
#define CONF_LEN         10

//NRF905 nrf905;

unsigned char rx_buf[BUF_LEN]= {0};
unsigned char read_config_buf[CONF_LEN];
unsigned char rx_address[4]= {0xcc,0xcc,0xcc,0xcc};
String str1="";

LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x20 for a 16 chars and 2 line display

void putstring(unsigned char *str)
{
   
    while(*str){
        str1 += char(*str++);
        //Serial.write(*str++);  
       
    }
}

void setup()
{
    char i;
    pinMode(10,OUTPUT);
    nrf905=NRF905(10);
   
    /** pin/port configuration */
    nrf905.init();

 
    /***************************************************
        default configuration, need to specify frequency
        choose Z-Wave frequency band, support :
        US  908.42Mhz
        EUROPE  868.42MHz
        AFRICA  868.42MHz
        CHINA  868.42MHz
        HK  919.82MHz
        JAPAN  853.42MHz
        AUSTRALIA 921.42MHz
        NEW_ZEALAND 921.42MHz
        BRASIL  921.42MHz
        RUSSIA  896MHz
    */
 nrf905.write_config(US);  
   
    /***********************************************************
 read register configuration, check register value written */
    nrf905.read_config(read_config_buf);
   
    /** serial communication configurate */
    Serial.begin(9600);
   
    /** test configuration */
    for(i=0; i<CONF_LEN; i++){
        Serial.print(read_config_buf[i],HEX);
        Serial.print(' ');
    }

  lcd.init();  // initialize the lcd
  lcd.backlight();
  lcd.print("start LCD2004");
 
  delay(1000);
 
  lcd.clear();
   
}

void loop()
{

    lcd.setCursor(0,0);
    lcd.print("S117:nRF905 RCV");
 
    /** recieve data packet with default RX address */
    nrf905.RX(rx_buf);
   
    /** recieve data packet with specified RX address */
    //    nrf905.RX(rx_buf, rx_address );
   
    // NOTE: TX_Address and RX_Address must be the same
   
    /** send recieved data to PC through serial port */       
    putstring(rx_buf);

    lcd.setCursor(0,1); 
    lcd.print(str1);
    str1 = "";
  
    delay(1);
}


 

Posted by RDIoT
|

MQTT + Kafka + Raspberry Pi ElasticSearch Cluster [P016]






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


* GitHub : https://github.com/rdiot/rdiot-p016


* Parts

- Arduino UNO

Ethernet W5100 Shield (W5100) [B004]

LCD1602 I2C (LCD1602) [D016]

Photo Resistor Module (KY-018) [S002]

Temperature and humidity DHT22 (DHT22) [S063]

TPM-300 Air Quality Module (TPM-300) [S092]

Samsung ARTIK 5 (ARTIK5-V0.5) [B023]

Raspberry Pi 3 B Model (RASPBERRY-PI-3-B) [B088] x 3ea : for Kafka Cluster

Raspberry Pi 3 B Model (RASPBERRY-PI-3-B) [B088] x 4ea : for ElasicSearch Cluster

- USB Power Supply

- Ethernet Hub


* Contents

1. Raspberry Pi ElasticSearch Cluster Setup

- version : elasticsearch 2.4.6

- master config
 : 
https://github.com/rdiot/rdiot-p016/blob/master/elasticsearch_es-pi-master-01.yml

- data node config 

 : https://github.com/rdiot/rdiot-p016/blob/master/elasticsearch_es-pi-data-01.yml

 : https://github.com/rdiot/rdiot-p016/blob/master/elasticsearch_es-pi-data-02.yml

 : https://github.com/rdiot/rdiot-p016/blob/master/elasticsearch_es-pi-data-03.yml




2. logstash configuration

https://github.com/rdiot/rdiot-p016/blob/master/logstash-kafka-elasticsearch-airGrade.conf

- https://github.com/rdiot/rdiot-p016/blob/master/logstash-kafka-elasticsearch-cds.conf

- https://github.com/rdiot/rdiot-p016/blob/master/logstash-kafka-elasticsearch-humidity.conf

- https://github.com/rdiot/rdiot-p016/blob/master/logstash-kafka-elasticsearch-temperature.conf


3. start logstash script example

#!/bin/sh

export LS_HEAP_SIZE="500m"

/data1/logstash/logstash/bin/logstash -f /data1/logstash/logstash-kafka-elasticsearch-temperature.conf -l logstash.log &


4. Kafka logstash Monitoring


5. ElasticSearch data node shard


6. Grafana Setup

- Install in Raspberry Pi

$ sudo apt-get install libfontconfig

$ curl -L https://github.com/fg2it/grafana-on-raspberry/releases/download/v4.0.1/grafana_4.0.1-1480722482_armhf.deb -o /tmp/grafana_4.0.1-1480722482_armhf.deb

$ sudo dpkg -i /tmp/grafana_4.0.1-1480722482_armhf.deb


$ sudo vi /etc/grafana/grafana.ini

# The ip address to bind to, empty will bind to all interfaces

http_addr = 192.168.0.20


$ sudo systemctl enable grafana-server

$ sudo systemctl restart grafana-server


- Connect Grafana WebAdmin

http://92.168.0.20:3000

id/pwd : admin/admin


- Add Data Sources : http://192.168.0.20:3000/datasources/new


- edit data source examples


7. Grafana Dashboard 

- Kafka-Sensor-Monitoring

 : Temperature, Humidity, Cds, AirGrade


Posted by RDIoT
|

MQTT + Kafka + Amazon ElasticSearch Service [P015]

 

 




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


* GitHubhttps://github.com/rdiot/rdiot-p015


* Parts

- Arduino UNO

Ethernet W5100 Shield (W5100) [B004]

LCD1602 I2C (LCD1602) [D016]

Photo Resistor Module (KY-018) [S002]

Temperature and humidity DHT22 (DHT22) [S063]

TPM-300 Air Quality Module (TPM-300) [S092]

Samsung ARTIK 5 (ARTIK5-V0.5) [B023]

Raspberry Pi 3 B Model (RASPBERRY-PI-3-B) [B088] x 3ea : for Kafka Cluster

- USB Power Supply

- Ethernet Hub

 

* Contents

1. Amazon ElasticSearch Service Setup

 - Define domain

- Configure cluster


- Set up access

- Review


Amazon Elasticsearch Service dashboard


2. ES Information example 

- ElasticSearch Endpoint : https://search-rdiot-aws-es-2yolnmmxbjghreiywdbh4yrsay.ap-northeast-2.es.amazonaws.com

- Kibana URL : https://search-rdiot-aws-es-2yolnmmxbjghreiywdbh4yrsay.ap-northeast-2.es.amazonaws.com/_plugin/kibana/



3. MQTT - Kafka - Bridge (json)

- source : https://github.com/rdiot/rdiot-p015/blob/master/MqttToKafkaReConn.java

- result 

{"time": 1511884443315,"value":724}

{"time": 1511884444405,"value":724}

{"time": 1511884445488,"value":723}

{"time": 1511884446579,"value":724}

{"time": 1511884447657,"value":726}


4. install logstash : tested logstash-2.4.1 

$ cd /data1/logstash

$ wget https://download.elastic.co/logstash/logstash/logstash-2.4.1.tar.gz

$ tar zxvf logstash-2.4.1.tar.gz

$ ln -s logstash-2.4.1 logstash


$ sudo apt-get install ant texinfo openjdk-8-jdk build-essential

$ git clone https://github.com/jnr/jffi.git

$ export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-armhf"

$ cd jffi

$ ant jar

$ sudo cp build/jni/libjffi-1.2.so /data1/logstash/logstash/vendor/jruby/lib/jni/arm-Linux


5. logstash config : tested logstash-2.4.1 

- source : https://github.com/rdiot/rdiot-p015/blob/master/logstash-kafka-aws-es.conf

input {

   kafka {

   zk_connect => "kafka-pi-01:2181"

   group_id => "logstash"

   topic_id => "cds"

   consumer_threads => 2

   decorate_events => true

   

  }

}


filter {

  json {

    source => "message"

  }

  date {

    match => [ "time", "UNIX"]

    target => "time_new"


  }   

}


output {

  elasticsearch {

    index => "test-%{+YYYY.MM.dd}"

    hosts => ["https://search-rdiot-aws-es-2yolnmmxbjghreiywdbh4yrsay.ap-northeast-2.es.amazonaws.com"]

    codec => json

  }

  stdout {

    codec => "rubydebug"

  }

}


6. Amazon ElasticSearch Query Sample



7. Kibana : Search & Chart 


 



Posted by RDIoT
|

ARTIK MQTT + Raspberry Pi Apache Kafka Cluster Bridge [P014]



* Arduino MQTT Client to ARTIK MQTT Broker


* ARTIK MQTT Broker & Raspberry Pi Kafka Cluster


* Run MQTT-Kafka-Bridge


* Kafka Console Consumer


* KafkaMonitor



https://www.youtube.com/watch?v=JIEIv-pEFFs


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


* Parts

- Arduino UNO

Ethernet W5100 Shield (W5100) [B004]

LCD1602 I2C (LCD1602) [D016]

Photo Resistor Module (KY-018) [S002]

Temperature and humidity DHT22 (DHT22) [S063]

TPM-300 Air Quality Module (TPM-300) [S092]

Samsung ARTIK 5 (ARTIK5-V0.5) [B023]

Raspberry Pi 3 B Model (RASPBERRY-PI-3-B) [B088] x 3ea

- USB Power Supply

- Ethernet Hub



* Contents

1.  ARTIK MQTT Start 

- mqtt broker (1883)

$ mosquitto &


2. Add MQTT Topics in the node-red

- node-red (1880)

$ node-red &


3. Arduino MQTT Client 

- source

https://github.com/rdiot/rdiot-p014/blob/master/arduino_mqtt_client.ino



4. MQTT Kakfa Bridge
- source

https://github.com/rdiot/rdiot-p014/blob/master/MqttToKafkaReConn.java

- maven 

    <!--  mqtt-client -->

<dependency>

    <groupId>org.fusesource.mqtt-client</groupId>

    <artifactId>mqtt-client</artifactId>

    <version>1.14</version>

</dependency>

<!-- kafka -->

<dependency>

<groupId>org.apache.kafka</groupId>

<artifactId>kafka_2.9.1</artifactId>

<version>0.8.2.1</version>

</dependency>


- run script

https://github.com/rdiot/rdiot-p014/blob/master/mqtt-kafka-bridge.sh

$ java -jar mqtt-kafka-bridge-0.0.1-SNAPSHOT.jar 

$ nohup java -jar mqtt-kafka-bridge-0.0.1-SNAPSHOT.jar > output.txt &


5. Kafka Console Consumer 

- run script

https://github.com/rdiot/rdiot-p014/blob/master/consumer.sh

$ /data1/kafka/kafka/bin/kafka-console-consumer.sh --zookeeper kafka-pi-01:2181,kafka-pi-02:2181,kafka-pi-03:2181 --topic $1


- run command

$ ./consumer.sh temperature,humidity,cds,airGrade

$ ./consumer.sh temperature


Posted by RDIoT
|

Crash Collision Sensor Detection Module [S230]





https://www.youtube.com/watch?v=1yeZcZQk-Y8


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


* Specs 

Wrobot Crash Sensor is arduino compatible and can be used for for robot collision detection, touch collision detection. 

It is based on the high sensitivity crash sensor. 

With the Arduino sensor expansion board, in combination, it can be very easy to achieve robot collision detection, touch collision detection. 


When touch, output low level ; when release, maintain a high level

Wrobot Crash Sensor pin definitions : (1) Output (2) Vcc (3) GND

Features :

1.Based on the high sensitivity crash sensor

2.Can be used for robot collision detection, touch collision detection

3.Type : Digital

4.Sensitivity : High

5.Power Supply : 5V

6.Pin Definitions : (1) Output (2) Vcc (3) GND

7.When touch, output low level ; when release, maintain a high level

8.Apply to a variety of platforms including Arduino/51/AVR/ARM


* Contents

- connect

OUT - D3

VCC - 5V

GND - GND

 

- Key Code

int ledPin = 13;                // choose the pin for the LED
int inputPin = 3;               // connect sensor to input pin 3
 
 
void setup() {
  Serial.begin(9600);           // Init the serial port
   
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare Micro switch as input
}
 
void loop(){
  int val = digitalRead(inputPin);  // read input value
  if (val == HIGH) {                // check if the input is HIGH
    digitalWrite(ledPin, LOW);      // turn LED OFF
  } else {
    digitalWrite(ledPin, HIGH);     // turn LED ON
    Serial.println("Switch Pressed!");
  }
  delay(50);
}


Posted by RDIoT
|

SunFounder RAB 5 in 1 Breadboard [B193]




* Specs

1) Compatibale with Raspberry Pi 3 Model B,2 Model B and 1 Model B+. 

2) For any Arduino board whose mounting holes are the same with For Arduino UNO and Mega 2560 can be fixed upon this Holder with screws. 

3) Be able to fix the 400 points and 800 points self-adhesive breadboard.

4) There are M3 fixing holes in the middle which can be used to fix the RAB Holder upon your experiment table.

5) Size:200*135mm ->7.87inch * 5.31inch.


- Technical Details Introduction

RAB Holder, also called Raspberry Pi, For Arduino and Breadboard Holder. Presumably you can know its function from the name. It can ensure the security of your demoboard and avoid placing the demoboard on the desk freely to cause short cut. The RAB Holder also simplifies your experiment when you are building a complex circuit. There are three zones on the RAB Holder and each has a name on it. We have made some slots in the zone that used to fix the Raspberry Pi to make the use more comfortable.

A screwdriver is provided for you to install the Raspberry Pi and for Arduino board onto the holder with screws. 


- Package Contents

2x M3*10 Screw 

4x M2.5*6 Screw 

6x M3*6 Screw 

1x RAB Holder

1 x Screwdriver


Posted by RDIoT
|

Call server API for multiple sensor information [P002]


 

https://www.youtube.com/watch?v=6oUOoBihOfo


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

 

* Parts

- Arduino Uno R3

- Ethernet W5100 Shield (W5100) [B004]

- LCD1602 (HD44780) [D002]

- Temperature and humidity DHT11 sensor module (KY-015) [S008]

- Button

 

* Contents

- Collect multiple (two temperature / humidity) sensor values on one sensor and load them into the server

Posted by RDIoT
|

Air Quality Sensor Measurement RGB Matrix Output [P004]



 

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

 

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

 

 https://www.youtube.com/watch?v=vl9jQZMoH-o


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

 

* Parts

- Arduino Mega

- Air Quality Sensor (MQ135) [S037]

- 32x64 RGB LED Matrix P4 (LM-P4-SMD-RGB-LED) [D025]

- SI7021 Humidity Sensor (GY-21) [S068]

- Photo Resistor Module (KY-018) [S002]

 

* Contents

- Key Code

#include <Adafruit_GFX.h>   // Core graphics library

#include <RGBmatrixPanel.h> // Hardware-specific library

#include <MQ135.h>

 

#include <Wire.h>

int pin = A5; // Air Quality Sensor

 

// LED Matrix 

#define OE   9

#define LAT 10

#define CLK 11

#define A   A0

#define B   A1

#define C   A2

#define D   A3

RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false, 64);

 

MQ135 gasSensor = MQ135(pin);

#define RZERO 76.63

 

double rzero;

double result;


int i=0;

 

double rzero;

double result;

 

void setup() {
  matrix.begin(); // LED Matrix init
  matrix.drawPixel(0, 0, matrix.Color333(7, 7, 7));
  delay(500);

  matrix.fillRect(0, 0, 64, 32, matrix.Color333(0, 7, 0));
  delay(3000);
}

 

void loop() {

  matrix.fillScreen(matrix.Color333(0, 0, 0));
  matrix.setCursor(1, 1);    // start at top left, with 8 pixel of spacin


  if (i==0) {
   rzero = gasSensor.getRZero(); // float
  }

  if (i>0) { 
   result = gasSensor.getRZero();
   rzero = (rzero + result)/2;
  }


  float co2_ppm = gasSensor.getPPM();


  matrix.println("rz:"+(String)rzero+" ");
  matrix.setCursor(1, 9);    // start at top left, with 8 pixel of spacing
  matrix.println("rs:"+(String)result+" ");
  matrix.setCursor(1, 16);    // start at top left, with 8 pixel of spacing
  matrix.println("D:"+(String)analogRead(pin)+" ");
  matrix.setCursor(1, 23);    // start at top left, with 8 pixel of spacing
  matrix.println("A:"+(String)co2_ppm+"ppm");

  i++;

  if(co2_ppm > 10)

  {

    matrix.drawRect(0, 0, 64, 32, matrix.Color333(0, 4, 7));

  }

  else

  {

  // matrix.drawRect(0, 0, 64, 32, matrix.Color333(0, 4, 7));

  }

  //cool down
  delay(1000);

}

Posted by RDIoT
|

UVC Camera Movie Monitoring [P006]



 

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


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

 

 

* Parts

- Arduino Yun (ARDUINO-YUN) [B015]

- Logitech HD WebCam C310 (C310) [S084]

 

 

* Contents

1. Install UVC Class

  : opkg update

  : opkg install kmod-video-uvc

   

2. Install mjpg-streamer

  : opkg install mjpg-streamer

 

3. config /etc/config/mjpg-streamer

   : config mjpg-streamer 'core'

         option device 'dev/video0'

         option resolution '640x480'

         option fps '30'

         option www '/www/webcam'

         option port '8080'

         option enabled '1'

 

4. startup mjpg-streamer

  : /etc/init.d/mjpg-streamer enable

  : /etc/init.d/mjpg-streamer start

 

5. Movie Monitoring by web browser

  : http://IP:8080/?action=stream

  : http://IP:8080/javascript_simple.html 

Posted by RDIoT
|

L9110 Fan Module (L9110) [D086]




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


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


* Specs

Designed for fire fighting robot and adopt 9110 H as the bridge drive
Can be used with steering engine to control the wind direction
Can control positive and negative going motion easily.
High quality propeller,high efficiency
Can be easily blow out the lighter flame(beyond 20 cm)
Working Voltage: 5V 
Color: Red + white + black
Size:Approx.34 x 26 x 12mm/1.33*1.02*0.47inch(excluding propeller)
Propeller Diameter : Approx. 75mm / 2.95 inch
Package Includes:
1 x Fan Motor Module


* Contents

- Connect 

INB ----- D8

INA ----- D9

VCC ----- 5V

GND ----- GND

 

- Source

int INA = 9; 

int INB = 8; 


void setup() 

  pinMode(INA,OUTPUT); 

  pinMode(INB,OUTPUT); 

void loop() 

  // LEFT

  digitalWrite(INA,LOW);

  digitalWrite(INB,HIGH); 

  delay(1000); 

  

  digitalWrite(INA,LOW);

  digitalWrite(INB,LOW); 

  delay(3000); 


  // RIGHT

  digitalWrite(INA,HIGH);

  digitalWrite(INB,LOW); 

  delay(1000); 


  digitalWrite(INA,LOW);

  digitalWrite(INB,LOW); 

  delay(3000); 

}

Posted by RDIoT
|

Arduino MQTT Client & ARTIK MQTT Broker [P012]





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


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



* Parts

- Arduino UNO

Ethernet W5100 Shield (W5100) [B004]

LCD1602 I2C (LCD1602) [D016]

Photo Resistor Module (KY-018) [S002]

Temperature and humidity DHT22 (DHT22) [S063]

TPM-300 Air Quality Module (TPM-300) [S092]

Samsung ARTIK 5 (ARTIK5-V0.5) [B023]



Posted by RDIoT
|

WeMos D1 Wifi Uno ESP8266 esp-12e [B175]



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


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


* Specs

Microcontroller ESP-8266EX

Operating Voltage 3.3V

Digital I/O Pins 11

Analog Input Pins 1(Max input: 3.2V)

Clock Speed 80MHz/160MHz

Flash 4M bytes

Length 68.6mm

Width 53.4mm

Weight 25g

OTA -- Wireless Upload(Program)

On board switching power supply -- Max 24V input, 5V 1A output

Support Ard uino IDE


Pin Function ESP-8266 Pin

TX TXD TXD

RX RXD RXD

A0 Analog input, max 3.3V input A0

D0 IO GPIO16

D1 IO, SCL GPIO5

D2 IO, SDA GPIO4

D3 IO, 10k Pull-up GPIO0

D4 IO, 10k Pull-up, BUILTIN_LED GPIO2

D5 IO, SCK GPIO14

D6 IO, MISO GPIO12

D7 IO, MOSI GPIO13

D8 IO, 10k Pull-down, SS GPIO15

G Ground GND

5V 5V -

3V3 3.3V 3.3V

RST Reset RST


* Contents

- Board Setup

http://arduino.esp8266.com/versions/2.3.0/package_esp8266com_index.json


- WebMos XI

https://www.wemos.cc/tutorial/getting-started-wemos-xi.html

https://github.com/wemos/Arduino_XI/archive/master.zip


- Key Code (example : helloServer)

#include <ESP8266WiFi.h>

#include <WiFiClient.h>

#include <ESP8266WebServer.h>

#include <ESP8266mDNS.h>

 

const char* ssid = "AP-B-2.4G";

const char* password = "32903290";

 

ESP8266WebServer server(80);

 

const int led = 13;

 

void handleRoot() {

  digitalWrite(led, 1);

  server.send(200, "text/plain", "hello RDIoT Wemos D1 Server Test from esp8266!");

  digitalWrite(led, 0);

}

 

void handleNotFound(){

  digitalWrite(led, 1);

  String message = "File Not Found\n\n";

  message += "URI: ";

  message += server.uri();

  message += "\nMethod: ";

  message += (server.method() == HTTP_GET)?"GET":"POST";

  message += "\nArguments: ";

  message += server.args();

  message += "\n";

  for (uint8_t i=0; i<server.args(); i++){

    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";

  }

  server.send(404, "text/plain", message);

  digitalWrite(led, 0);

}

 

void setup(void){

  pinMode(led, OUTPUT);

  digitalWrite(led, 0);

  Serial.begin(115200);

  WiFi.begin(ssid, password);

  Serial.println("");

 

  // Wait for connection

  while (WiFi.status() != WL_CONNECTED) {

    delay(500);

    Serial.print(".");

  }

  Serial.println("");

  Serial.print("Connected to ");

  Serial.println(ssid);

  Serial.print("IP address: ");

  Serial.println(WiFi.localIP());

 

  if (MDNS.begin("esp8266")) {

    Serial.println("MDNS responder started");

  }

 

  server.on("/", handleRoot);

 

  server.on("/rdiot", [](){

    server.send(200, "text/plain", "Hi I'm RD IoT...");

  });

 

  server.onNotFound(handleNotFound);

 

  server.begin();

  Serial.println("HTTP server started");

}

 

void loop(void){

  server.handleClient();

}

Posted by RDIoT
|

WeMos D1 mini 0.66 inch 64x48 OLED Shield [D056]



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


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


* Specs

OLED Shield for WeMos D1 mini 0.66" inch 64X48 IIC I2C


* Contents

- Library : https://github.com/sparkfun/SparkFun_Micro_OLED_Arduino_Library/tree/V_1.1.2

- Tested Example : https://github.com/wemos/D1_mini_Examples/archive/master.zip

 : D1_mini_Examples-master\04.Shields\OLED_Shield\Use_SparkFun_Library

Posted by RDIoT
|

65K Color OLED 0.95 SPI 96x64 (SSD1331) [D058]





https://www.youtube.com/watch?v=7Vf7K8ApiUw


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


* Specs

Driver Chip SSD1331 

Interface SPI 

Resolution 96×64 

Display Size 0.95inch 

Colors 65K colorful 

Visible Angle >160° 

Operating Temp. (℃) -20~70 

Storage Temp. (℃) -30~80 

Operating Voltage 3.3V / 5V 


* Contents

- Connect

GND: Power ground ----- GND

VCC:2.8-5.5V power supply ----- 5V

D0: CLK clock ----- D13

D1: MOSI data ----- D11

RST: Reset ----- D9

DC: data / command ----- D8

CS: chip-select signal ----- D10


- Library :  https://github.com/adafruit/Adafruit-SSD1331-OLED-Driver-Library-for-Arduino


Posted by RDIoT
|

OLED 0.96 I2C 128x64 White (SSD1306) [D044]



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


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


* Specs

128X64 OLED LCD LED Display Module white For Arduino 0.96" I2C IIC SPI Serial new original



* Contents

- Library : https://bintray.com/olikraus/u8glib/Arduino

- Library Desc : http://code.google.com/p/u8glib/wiki/u8glib


- Key Code

#include "U8glib.h"


U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);


void loop(void) {

  // picture loop

  u8g.firstPage();  

  do {

    draw();

  } while( u8g.nextPage() );


  // rebuild the picture after some delay

  delay(500);

}


void draw(void) {

  u8g.setFont(u8g_font_9x15B);

  u8g.setPrintPos(0, 12); 

  u8g.println("OLED 0.96 ");


  u8g.setFont(u8g_font_helvB14);

  u8g.setPrintPos(0,40);

  u8g.println("I2C 128x64");


  u8g.setPrintPos(0,60); 

  u8g.print("Blue"); // Actually White

}

Posted by RDIoT
|

OLED 0.96 I2C 128x64 (SSD1306) [D003]



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


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


* Specs

0.96" Inch Yellow and Blue I2C IIC OLED LCD Module Serial 128X64 LED Display for Arduino 51 MSP420 STIM32 SCR lcd display

Support wide voltage: 3.3V-5V DC

Driver IC: SSD1306

Communication: IIC, only two I / O ports

Viewing angle: greater than 160 degrees

Size: 0.96


* Contents

- Library : https://bintray.com/olikraus/u8glib/Arduino

- Library Desc : http://code.google.com/p/u8glib/wiki/u8glib


- Key Code

#include "U8glib.h"


U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);


void loop(void) {

  // picture loop

  u8g.firstPage();  

  do {

    draw();

  } while( u8g.nextPage() );


  // rebuild the picture after some delay

  delay(500);

}


void draw(void) {

  u8g.setFont(u8g_font_9x15B);

  u8g.setPrintPos(0, 12); 

  u8g.println("HC-SR04");


  u8g.setFont(u8g_font_helvB14);

  u8g.setPrintPos(0,40);


  int var = 0;

  u8g.print("Dist.="+(String)var+"mm");

}

Posted by RDIoT
|

OLED 0.91 I2C 128x32 White (SSD1306) [D054]



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


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


* Specs

0.91 Inch OLED LCD Module SPI/IIC Interface 128*32 Dot Matrix  new original


* Contents

- DataSheet : http://www.buydisplay.com/download/manual/ER-OLED0.91-1_Series_Datasheet.pdf


- Connect

GND ----- GND

VCC ----- 3.3~5V

SCK ---- SCL

SDA ---- SDA


- Key Code


#include "U8glib.h"

U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); 


void loop(void) {


  // picture loop

  u8g.firstPage();  

  do {

    draw();

  } while( u8g.nextPage() );

  // rebuild the picture after some delay


  delay(500);

}


void draw(void) {

  u8g.setFont(u8g_font_9x15B);

  u8g.setPrintPos(0, 12); 

  u8g.println("OLED 0.91");

  u8g.setFont(u8g_font_helvB14);

  u8g.setPrintPos(0,30);

  int var = 0;

  u8g.print("128x32");

}

Posted by RDIoT
|

8-Digit 7 Segment Module (MAX7219) [D066]




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


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


* Specs

Features:

100% Brand new and high quality

MAX7219 digital display control module

This module is compatible with 5V and 3.3V microcontrollers.

You you can use it for Arduino

MAX7219 is an integrated serial input / output common-cathode display driver, which connects your microprocessor to a 7-segment digital LED display with 8 digits.

Only three IO ports are used to drive the eight digit display. MAX7219 supports flicker free displays as well as cascading displays.


Specifications:

Material: PCB + Electronic Components

Power: 5V

Size: 82*15*12mm(L*W*H)

Shell Color: Blue & black

Net Weight:13g


Package includes:

1* MAX7219 digital display module

1* Straight 5 pin header

1* 90 degree 5 pin header


Wiring instructions(for example, it can connect any IO port, modified the Port Definition in the program):

VCC: 5V

GND: GND

DIN: P00

CS: P01

CLK: P02



* Contents

- Connect

DIN........D11

CS (LOAD)..D10

CLK........D13


- Library : https://github.com/HobbyComponents/HCMAX7219


- Key Code (Tested Example)

/* FILE:    HCMODU0082_Serial_7_Segment_Module_Example1

   DATE:    19/03/15

   VERSION: 0.2

  

REVISIONS:

12/03/15 Created version 0.1

19/03/15 Updated to work with V0.2 of the HCMAX7219 library

This is an example of how to use the Hobby Components serial 8 digit seven 7 

segment display module (HCMODU0082). To use this example sketch you will 

need to download and install the HCMAX7921 library available from the software

section of our support forum (forum.hobbycomponents.com) or on github:

(https://github.com/HobbyComponents)


The library assumes you are using one module. If you have more than one module

connected together then you will need to change the following line in the 

libraries HCMAX7219.h header file to the number of drivers you have connected:


#define NUMBEROFDRIVERS 1 <- Change this number


PINOUT:

MODULE.....UNO/NANO.....MEGA

VCC........+5V..........+5V

GND........GND..........GND

DIN........11...........51

CS (LOAD)..10...........10

CLK........13...........52


You may copy, alter and reuse this code in any way you like, but please leave

reference to HobbyComponents.com in your comments if you redistribute this code.

This software may not be used directly for the purpose of promoting products that

directly compete with Hobby Components Ltd's own range of products.


THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, 

WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED 

WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR

LACK OF NEGLIGENCE. HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE

FOR ANY DAMAGES INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR 

CONSEQUENTIAL DAMAGES FOR ANY REASON WHATSOEVER. */


/* Include the HCMAX7219 and SPI library */

#include <HCMAX7219.h>

#include "SPI.h"


/* Set the LOAD (CS) digital pin number*/

#define LOAD 10


/* Create an instance of the library */

HCMAX7219 HCMAX7219(LOAD);


/* Main program */

void loop() 

{

  /* Clear the output buffer */

  HCMAX7219.Clear();


  /* Write some text to the output buffer */

  HCMAX7219.print7Seg("HELLO !!",8);


  /* Send the output buffer to the display */

  HCMAX7219.Refresh();  


  delay(2000);


  /* Clear the output buffer */

  HCMAX7219.Clear();


  /* Write some text to the output buffer */

  HCMAX7219.print7Seg("D066",8);


  /* Send the output buffer to the display */

  HCMAX7219.Refresh();  


  delay(2000);


  /* Clear the output buffer */

  HCMAX7219.Clear();


  /* Write some text to the output buffer */

  HCMAX7219.print7Seg("8-Digit",8);


  /* Send the output buffer to the display */

  HCMAX7219.Refresh();  


  delay(2000);


  /* Clear the output buffer */

  HCMAX7219.Clear();


  /* Write some text to the output buffer */

  HCMAX7219.print7Seg("MAX7219",8);


  /* Send the output buffer to the display */

  HCMAX7219.Refresh();  


  delay(2000);


  HCMAX7219.Clear();

  for (int Position = 1; Position <= 7; Position++)

  { 

    HCMAX7219.print7Seg(-1234567,Position,8);

    HCMAX7219.Refresh();

    delay(1000);

  }



  /* Clear the output buffer */

  HCMAX7219.Clear();


  /* Write some text to the output buffer */

  HCMAX7219.print7Seg("BYE",8);


  /* Send the output buffer to the display */

  HCMAX7219.Refresh();  


  delay(2000);


  while(1);

}

Posted by RDIoT
|

4 Digit Tube LED Display Module (TM1637) [D014]



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


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


* Specs

The module is a 12-foot clock with 4 points of positive digital (0.36 inches) display module driver IC TM1637, only two signal lines can make SCM four 8-segment LED.


Module features are as follows:

Display of male red for the four digital tube

Adjustable digital tube 8 gray

Level control interface for 5V or 3.3V

4 M2 screws positioning holes for easy installation


4 digital display interface module as shown below:

Control Interface: A total of four pins (GND, VCC, DIO, CLK), GND to ground, VCC is the power supply, DIO of data input and output pin, CLK is the clock signal pin;

Digital tube: 4 common anode score points with 0.36 inches LED, red highlights;

Positioning holes: 4 M2 screws positioning hole diameter is 2.2mm, the positioning of the module is easy to install, to achieve inter-module combination.



* Contents

- DataSheet : http://www.datasheet-pdf.com/pdfhtm.php?id=788613&p=10


- Connect

CLK ----- D2

DIO ----- D3

VCC ----- 5V

GND ----- GND


- Library : https://github.com/avishorp/TM1637


- Key Code : Example TM1637Test.ino

#include <Arduino.h>

#include <TM1637Display.h>


// Module connection pins (Digital Pins)

#define CLK 2

#define DIO 3


// The amount of time (in milliseconds) between tests

#define TEST_DELAY   2000


const uint8_t SEG_DONE[] = {

 SEG_B SEG_C SEG_D SEG_E SEG_G,           // d

 SEG_A SEG_B SEG_C SEG_D SEG_E SEG_F,   // O

 SEG_C SEG_E SEG_G,                           // n

 SEG_A SEG_D SEG_E SEG_F SEG_G            // E

 };


TM1637Display display(CLK, DIO);


void loop()

{

  int k;

  uint8_t data[] = { 0xff, 0xff, 0xff, 0xff };

  display.setBrightness(0x0f);


  // All segments on

  display.setSegments(data);

  delay(TEST_DELAY);


  // Selectively set different digits

  data[0] = 0b01001001;

  data[1] = display.encodeDigit(1);

  data[2] = display.encodeDigit(2);

  data[3] = display.encodeDigit(3);


  for(k = 3; k >= 0; k--) {

    display.setSegments(data, 1, k);

    delay(TEST_DELAY);

  }


  display.setSegments(data+2, 2, 2);

  delay(TEST_DELAY);


  display.setSegments(data+2, 2, 1);

  delay(TEST_DELAY);


  display.setSegments(data+1, 3, 1);

  delay(TEST_DELAY);



  // Show decimal numbers with/without leading zeros

  bool lz = false;

  for (uint8_t z = 0; z < 2; z++) {

   for(k = 0; k < 10000; k += k*4 + 7) {

   display.showNumberDec(k, lz);

   delay(TEST_DELAY);

   }

  lz = true;

  }


  // Show decimal number whose length is smaller than 4

  for(k = 0; k < 4; k++)

   data[k] = 0;

   display.setSegments(data);


   display.showNumberDec(153, false, 3, 1);

   delay(TEST_DELAY);

   display.showNumberDec(22, false, 2, 2);

   delay(TEST_DELAY);

   display.showNumberDec(0, true, 1, 3);

   delay(TEST_DELAY);

   display.showNumberDec(0, true, 1, 2);

   delay(TEST_DELAY);

   display.showNumberDec(0, true, 1, 1);

   delay(TEST_DELAY);

   display.showNumberDec(0, true, 1, 0);

   delay(TEST_DELAY);



  // Brightness Test

  for(k = 0; k < 4; k++)

    data[k] = 0xff;

    for(k = 0; k < 16; k++) {

      display.setBrightness(k);

      display.setSegments(data);

      delay(TEST_DELAY);

    }

  // Done!

  display.setSegments(SEG_DONE);

  while(1);

}

Posted by RDIoT
|

7Segment 4 Digit LED Module (5461AS) [D013]



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


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


* Contents

- DataSheet : http://deneb21.tistory.com/attachment/cfile24.uf@247A634855D713A025946C.pdf


- Connect

http://thomas.bibby.ie/wp-content/uploads/2015/10/KYX-5461AS-300x194.jpg


- Connect LM35

VCC - 5V

Output - A0

GND - GND


- Key Code

int sensorPin = 0;


//display pins

int segA = 5;

int segB = 13;

int segC = 10;

int segD = 8;

int segE = 7;

int segF = 4;

int segG = 11;

int segPt = 9;


int d1 = 6;

int d2 = 3;

int d3 = 2;

int d4 = 12;


int delayTime = 900;


int counter = 0;


float temperature = 77.7;


//only read temp every 100 cycles

if(counter%500 == 0)

{

  // read the pin

  int reading = analogRead(sensorPin);

  

  //convert reading to volts

  float volts = (reading * 5.0);

  volts /= 1024.0;


  temperature = volts * 100.0;


 counter = 0;

}


counter ++;


selectDigit(1);

sendDigit(tens(temperature));

delayMicroseconds(delayTime);


...

Posted by RDIoT
|

DZ292 Laser Receiver Module (DZ292) [S035]



https://www.youtube.com/watch?v=iPmirgi-yPs


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


* Specs

PCB size:1.52*2.22cm

work voltage:5V

Output:

output high level when receive laser signal;

output low level when not receive laser signal.


* Contents

- Key Code

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>


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


int laserPin = 2; // Laser

int laserRcvPin = 7; // Laser Receiver


void setup()

{

  lcd.init();  // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD2004");


  pinMode(laserPin,OUTPUT);

  pinMode(laserRcvPin,INPUT);


  digitalWrite(laserPin, HIGH);

  delay(1000);


  lcd.clear();

}


void loop()

  lcd.setCursor(0,0);

  lcd.print("S035:DZ292 LaserRCV");


  int rcv = digitalRead(laserRcvPin);


  lcd.setCursor(0,2);

  lcd.print("laser value=" + (String)rcv);


  if(rcv == 1)

  {

    lcd.setCursor(0,3);

    lcd.print("laser detected");

  }

  else

  {  

    lcd.setCursor(0,3);

    lcd.print("                    ");

  }

}

'3) Actuator > Laser' 카테고리의 다른 글

Laser+LED 2 in 1 module [D048]  (0) 2016.10.05
Red Laser Cross Line Module + [D037]  (0) 2016.10.05
Red Laser Line Module - [D036]  (0) 2016.10.05
650nm Laser Diode Module (KY-008) [D004]  (0) 2016.10.05
Red Laser Point Linear Module [D079]  (0) 2016.09.05
Posted by RDIoT
|

650nm Laser Diode Module (KY-008) [D004]



https://www.youtube.com/watch?v=7h7lJ4rDAcQ


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


* Specs

High Quality 650nm Laser sensor Module 6mm 5V 5mW Red Laser Dot Diode Copper Head KY-008

Product Details:

Laser sensor Module

Condition: New

Operating voltage 5V

Output wavelength 650 nm

3 pins module

With fixed bolt hole for easy installation

Color: show as pictures

PLS NOTE that due to lighting effects, monitor's brightness / contrast settings etc, there could be some slight differences in the color tone of the pictures and the actual item!


* Contents

- Key Code

#include "U8glib.h"

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);

 

int laserPin = 10;

int btnPin = 2;

 

void setup() {

  // put your setup code here, to run once:

   pinMode (laserPin, OUTPUT); // laser

   pinMode (btnPin, INPUT); // button

}

 

void loop(void) {

  // picture loop

  u8g.firstPage();  

  do {

    draw();

  } while( u8g.nextPage() );

  

  // rebuild the picture after some delay

  delay(500);

}

 

void draw(void) {

  u8g.setFont(u8g_font_9x15B);

  u8g.setPrintPos(0, 12); 

  u8g.println("Laser Emit");

 

  u8g.setFont(u8g_font_fub17);

  u8g.setPrintPos(0,40);

 

  int btn = digitalRead(btnPin);

  u8g.print("btn="+(String)btn);

 

  if(btn == 1)

  {

    digitalWrite (laserPin, HIGH);

  }

  else

  {

    digitalWrite (laserPin, LOW);

  }

 

/*

   digitalWrite (laserPin, HIGH); // Turn Laser On

   delay (1000); // On For Half a Second

   digitalWrite (laserPin, LOW); // Turn Laser Off

   delay (500); // Off for half a second

*/

 

}

'3) Actuator > Laser' 카테고리의 다른 글

DZ292 Laser Receiver Module (DZ292) [S035]  (0) 2016.10.05
Laser+LED 2 in 1 module [D048]  (0) 2016.10.05
Red Laser Cross Line Module + [D037]  (0) 2016.10.05
Red Laser Line Module - [D036]  (0) 2016.10.05
Red Laser Point Linear Module [D079]  (0) 2016.09.05
Posted by RDIoT
|

L9110S 2-Channel Dual Motor Driver (L9110S) [B042]



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


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


* Specs

The L9110S 2-Channel motor driver module is a compact board that can be used

to drive small robots. This module has two independent motor driver chips which can

each drive up 800mA of continuous current. The boards can be operated from 2.5V to

12V enabling this module to be used with both 3.3V and 5V microcontrollers.



On-board 2 L9110 motor control chip

Module can be driven by two dc motors at the same time or one phase 4 line 2 type stepping motor

Input voltage: 2.5-12V DC

Each channel has a continuous output current 800 ma

PCB Size: 29.2mm x 23mm



* Contents

- Connect

Motor Driver gnd, vcc --- Arduino gnd, Vcc

B-1A --- A0

B-1B --- A1



- Key Code

void setup() {

  pinMode(A0,OUTPUT);

  pinMode(A1,OUTPUT);

}

 

void loop() {

  // put your main code here, to run repeatedly

  digitalWrite(A0,HIGH);

  digitalWrite(A1,LOW);

  delay(1000);


  digitalWrite(A0,LOW);

  digitalWrite(A1,HIGH);

  delay(1000);


  digitalWrite(A0,LOW);

  digitalWrite(A1,LOW);

  delay(2000);

}

Posted by RDIoT
|

ULN2003 Stepper Motor driver (X113647) [B002]



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


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


* Specs

Driver ID : ULN2003AN

Description:

Rated Voltage: DC5V

4-phase

Reduction Ratio: 1/64

Step Torque Angle: 5.625/64

DC Resistance: 200±7% (25)

Insulation Resistance: >10M (500V)

Dielectric Strength: 600V AC / 1mA / 1s

Insulation Grade: A

No-load Pull in Frequency: >600Hz

No-load Pull out Frequency: >1000Hz

Pull in Torque: >34.3mN.m(120Hz)

Detent Torque: >34.3mN.m

Temperature Rise: <40K(120Hz)

Noise: <40dB (120Hz, No load, 10cm)

Board Size: Approx. 29 ×21 mm


* Contents

- Connect

5V -  ----- 5V 

5V +  ----- GND

 

IN1 ----- D8

IN2 ----- D9

IN3 ----- D10

IN4  ----- D11


- Key Code

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>

#include <Stepper.h>

 

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

const int stepsPerRevolution = 2048; // 2048(360 Degree), 1024(180 Degree)

 

// IN4, IN2, IN3, IN1

Stepper myStepper(stepsPerRevolution,11,9,10,8); 

 

int val;

 

void setup()

{

  lcd.init();  // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD2004");

 

  delay(1000);

  

  myStepper.setSpeed(14); 

  lcd.clear();

}

 

void loop()

{ 

  lcd.setCursor(0,0);

  lcd.print("D021:28BYJ-48");

  lcd.setCursor(0,1);

  lcd.print("B002:X113647");

 

  // Left 1 Round

  myStepper.step(stepsPerRevolution);

  val = stepsPerRevolution;

  lcd.setCursor(0,2);

  lcd.print("right=" + (String)val + "  ");

  delay(500);

 

  // Right 1 Round

  myStepper.step(-stepsPerRevolution);

  val = -stepsPerRevolution;

  lcd.setCursor(0,2);

  lcd.print("left=" + (String)val + "   ");

  delay(500); 

}



Posted by RDIoT
|

Control H Bidge Gear Motor Control [P003]



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


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


* Parts

- Arduino Uno R3

- L298N Dual Motor Driver H Bridge (L298N) [B005]

- TT Motor Car Gear Motor [S142]

 

 

* Contents

- Connect

ENA ----- D9

IN1 ----- D2

IN2 ----- D3

ENB ----- D10

IN3 ----- D4

IN4 ----- D5


- Key Code

int dir1PinA = 2;

int dir2PinA = 3;


int dir1PinB = 4;

int dir2PinB = 5;


int speedPinA = 9;

int speedPinB = 10;


int speed1;

int dir;


void setup()

{


  pinMode(dir1PinA,OUTPUT); // IN1

  pinMode(dir2PinA,OUTPUT); // IN2

  pinMode(speedPinA,OUTPUT); // ENA


  pinMode(dir1PinB,OUTPUT); // IN3

  pinMode(dir2PinB,OUTPUT); // IN4

  pinMode(speedPinB,OUTPUT); // ENB


  speed1 = 200;

  dir = 1;


  delay(1000);


}


void loop()

{


  //analogWrite(speedPinA, speed1); // 200 -> ENA 

  if(dir == 1)

  {

    digitalWrite(speedPinA, HIGH);

    digitalWrite(speedPinB, HIGH);

    

    digitalWrite(dir1PinA, LOW);

    digitalWrite(dir2PinA, HIGH);


    digitalWrite(dir1PinB, LOW);

    digitalWrite(dir2PinB, HIGH);

    

    delay(5000);


    digitalWrite(speedPinA, HIGH);

    digitalWrite(speedPinB, HIGH);

    

    digitalWrite(dir1PinA, HIGH);

    digitalWrite(dir2PinA, LOW);

    

    digitalWrite(dir1PinB, HIGH);

    digitalWrite(dir2PinB, LOW);

    

    delay(5000);


  }

}

Posted by RDIoT
|

L298N Dual Motor Driver H Bridge (L298N) [B005]



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


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

* Specs

Description:

Using L298N as the control chip,the module has such characteristics as strong driving ability,low calorific value and strong anti-interference ability. This module can use built-in 78M05 for electric work via a driving power supply part. But to avoid the damage of the voltage stabilizing chip, please use an external 5V logic supply when using more than 12V driving voltage. Using large capacity filter capacitor, this module can follow current to protect diodes,and improve the reliability.


Feature:

L298N Double H Bridge Motor Driver Module Control chip: L298N Logical voltage: 5V Drive voltage: 5V - 35V Logical current: 0mA - 36mA Drive current: 2A(MAX single bridge) Storage temperature: -20°C to +135°C Max power: 25W Size: 43 x 43 x 27mm


* Contents

- Connect

12V ------ 9V VCC

GND ----- 9V GND, Arduino GND

5V ----- Arduino 5V


ENA ----- D9

IN1 ----- D2

IN2 ----- D3


OUT1 ----- Motor +

OUT2 ----- Motor -


- Key Code 

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>


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


int dir1PinA = 2;

int dir2PinA = 3;

int speedPinA = 9;

int speed1;

int dir;


void setup()

{

  lcd.init();  // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD2004");


  pinMode(dir1PinA,OUTPUT); // IN1

  pinMode(dir2PinA,OUTPUT); // IN2

  pinMode(speedPinA,OUTPUT); // ENA

  speed1 = 200;

  dir = 1;


  delay(1000);


  lcd.clear();

}


void loop()

{

 

  lcd.setCursor(0,0);

  lcd.print("B005:L298N Driver");


  //analogWrite(speedPinA, speed1); // 200 -> ENA 

  if(dir == 1)

  {

    digitalWrite(speedPinA, HIGH);

    digitalWrite(dir1PinA, LOW);

    digitalWrite(dir2PinA, HIGH);

    lcd.setCursor(0,1);

    lcd.print("ENA=" + (String)speedPinA + " HIGH");   

    lcd.setCursor(0,2);

    lcd.print("IN1=" + (String)dir1PinA + " LOW ");

    lcd.setCursor(0,3);

    lcd.print("IN2=" + (String)dir2PinA + " HIGH ");

    delay(5000);


    digitalWrite(speedPinA, HIGH);

    digitalWrite(dir1PinA, HIGH);

    digitalWrite(dir2PinA, LOW);

    lcd.setCursor(0,1);

    lcd.print("ENA=" + (String)speedPinA + " HIGH");   

    lcd.setCursor(0,2);

    lcd.print("IN1=" + (String)dir1PinA + " HIGH ");

    lcd.setCursor(0,3);

    lcd.print("IN2=" + (String)dir2PinA + " LOW ");

    delay(5000);


    digitalWrite(speedPinA, LOW);

    lcd.setCursor(0,1);

    lcd.print("ENA=" + (String)speedPinA + " LOW ");   

    

    lcd.setCursor(0,2);

    lcd.print("IN1= STOP  ");   

  

    lcd.setCursor(0,3);

    lcd.print("IN2= STOP  ");   


    dir = 0;

  }

}



Posted by RDIoT
|

100RPM Gear Motor [S141]



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


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


* Specs

Description:  

This is a DC Mini Metal Gear Motor,ideal for making robots

Light weight, high torque and low RPM.

Fine craftsmanship,durable,not easy to wear.

With excellent stall characteristics,can climb hills easily.

You can also easily mount a wheel on the motor’s output shaft.

 

Specification:

We guarantee the high quality condition for you

Rated Voltage:DC 12V

Speed:100RPM

Shaft Diameter:3mm

Size:Diameter: 12 mm

fuselage without shaft length: 26 mm 

Output axial length: 10 MM to 4.4 MM

Name:DC Mini Metal Gear Motor.

Voltage range:6-12V

Posted by RDIoT
|

TT Motor Car Gear Motor [S142]



https://www.youtube.com/watch?v=Kw7BCf-NGGE


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


* Specs

Operating voltage: 3V~12VDC (recommended operating voltage of about 6 to 8V)

Maximum torque: 800gf cm min (3V)

No-load speed: 1:48 (3V time)

The load current: 70mA (250mA MAX) (3V)

This motor with EMC, anti-interference ability. The microcontroller without interference.

Size: 7x2.2x1.8cm(approx)

Voltage load current No-load speed

 6V ≤200mA 200 ± 10% rpm

 3V ≤150mA 90 ± 10% rpm



* Contents

- Key Code

void setup() {

  pinMode(A0,OUTPUT);

  pinMode(A1,OUTPUT);

}



void loop() {

  // put your main code here, to run repeatedly:


  digitalWrite(A0,HIGH);

  digitalWrite(A1,LOW);

  delay(1000);


  digitalWrite(A0,LOW);

  digitalWrite(A1,HIGH);

  delay(1000);


  digitalWrite(A0,LOW);

  digitalWrite(A1,LOW);


  delay(2000);

}

Posted by RDIoT
|

Clamp Gripper Bracket Servo Mount [B045]



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


* Specs

Use:Vehicles & Remote Control Toys

Technical parameters:Value 2

RC Parts & Accs:Servo Accessories

Model Number:gripper

Robot Clamp Gripper Bracket Servo Mount Plastic Claw Arm kit For MG995 MG996 SG5010 Servo use of the egineering Plastics material very light, solid and hardness

'3) Actuator > Motor' 카테고리의 다른 글

100RPM Gear Motor [S141]  (0) 2016.10.05
TT Motor Car Gear Motor [S142]  (0) 2016.10.05
4-Phase 5-Wire Stepper Motor (28BYJ-48) [D021]  (0) 2016.10.04
TowerPro SG5010 Micro Servo (SG5010) [D032]  (0) 2016.10.04
SG90 Camera Mount [B051]  (0) 2016.10.04
Posted by RDIoT
|