Posted on Leave a comment

how to test Digital temperature sensor DS18B20 with arduino uno

There are many types of temperature sensors, which are divided into contact type and non-contact type according to the measurement method, thermal resistance and thermocouple according to the sensor material, and analog and digital according to the working principle. The previous article introduced the analog temperature sensor LM35, and this article introduced the use of the digital temperature sensor DS18B20.

Introduction to DS18B20 DS18B20 is a commonly used digital temperature sensor, which uses an integrated chip and uses a single bus technology to effectively reduce external interference and improve measurement accuracy. The output is a digital signal, and the wiring is very convenient. It can be applied to different occasions in different ways, such as pipe type, screw type, magnet adsorption type, and stainless steel package type.

Main feature:

Use a single bus interface. Only one data line is needed for bidirectional communication.

Wide measuring range and high accuracy. The measurement range is -55 ℃ — + 125 ℃, and the accuracy is ± 0.5 ℃ in the range of -10— + 85 ℃. Multi-point networking function. Multiple DS18B20 can be connected in parallel on the only three lines to achieve multi-point temperature measurement.

Flexible power supply. Power can be obtained from the data line through internal parasitic circuits.

The measurement parameters are configurable. The measurement resolution of DS18B20 can be set to 9-12 bits through the program. Power-off protection function. It contains EEPROM, after the system is powered off, it can still save the resolution and alarm temperature settings.

  • Install the library Two libraries are used in this experiment, namely “OneWire” and “DallasTemperature”, the former is a single bus library, and the latter is a library packaged for Dallas temperature sensors based on the former.

Click “Project”-“Load Library”-“Manage Library” in the IDE, find “OneWire”, select the latest version to install. The latest version is currently 2.3.4.

  1. Experimental steps
  2. Build the circuit diagram according to the schematic diagram. The line connection is very simple. The VCC, DQ, and GND of the DS18B20 are connected to the 5V, 2, and GND of the development board, respectively. A 10K resistor is connected to VCC at one end, and DQ is connected at the other end, and the pull-up resistor is used to improve the drive capability of the I / O port.

The experimental schematic diagram is shown below:


#include <OneWire.h>
#include <DallasTemperature.h>
// 数据输出脚接开发板数字引脚2
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup(void)
void loop(void)
  sensors.requestTemperatures(); // 发送命令获取温度
  Serial.print("Temperature for the device 1 (index 0) is: ");

3.Connect the development board, set the corresponding port number and development board type, and download the program

Posted on Leave a comment

How to make a cheap 2.4G Arduino RC robot tank?

parts list:

1. Arduino Nano

2. Motor shield Driver L298n

3. The chassis for the tank Option №1

other arduino robot tank chassis see here

4. Wires connecting

5. Servo SG90

6. Joystick PS2 remote control

7. Batteries diy

8. Swivel servo cloud system

some arduino guide:

How to program the Arduino:

1. Download

2. Download and install the library

3. Download the driver for the Chinese Arduino CH340 and install it

4. Download the sketch (quick turns – both on video)


. or download a sketch (slow corners)


5. Fill in the Arduino sketch.

Posted on Leave a comment

how to make Arduino Remote Control robot Tank with WiFi Camera nRF24L01?


In this tutorial we will learn to build a remote controlled car / tank. We will also add a WiFi camera to make the Tank more equipped. We will use the nRF24L+ module for remote control. With this tutorial, you can learn motor control with the joystick, remote motor control, and motor control with the nRF24L01.

Part List:

Arduino Uno R3 Arduino Nano nRF24L01

nRF24L Adapter – L298N Motor Driver ps2 Joystick

Tank Chassis Model 1 Breadboard DIY plate Jumper/Wires – Battery Plug –

Battery 9V –

Optional (If you want to add Camera) Mini WiFi CCTV IP Camera – Mini Sg90 Servo Potentiometer –

Also Recommended other Hardwares:

Lipo Battery –

nRF24L Antenna

NRF24L01+PA+LNA Wireless Module with Antenna 1000 Meters Long Distance FZ0410

FPV Camera –

FPV Goggles –


Tutorials about using the nRF24L+ library

Source Code





more detail

Posted on Leave a comment

SNARM with Joystick arduino code

SoftwareSerial mySerial(12, 13); // RX, TX
const int SERVOS = 4;
Servo myservo[SERVOS];
int afrom[] = {90, 35, 135}, ato[] = {20, 140, 110}, amiddle[] = {20, 35, 135}, afinal[] = {179,75,95}, aafterfinal[] = {179,35,135};
int DELAYTIME = 200;
int servo_moving[SERVOS] = {0,0,0,0};
boolean stringComplete = false;
int bt_servo = 0;
int bt_move = 0;
int idle = 0;

void setup() {
  pinMode(3, OUTPUT);  
  digitalWrite(3, HIGH); 
void loop() {
void init_Pins(){
  PIN[0] = 11;
  MIN[0] = 0;
  MAX[0] = 179;
  INITANGLE[0] = 90;
  PIN[1] = 10;
  MIN[1] = 35;
  MAX[1] = 179;
  INITANGLE[1] = 90;
  PIN[2] = 9;
  MIN[2] = 90;
  MAX[2] = 179;
  INITANGLE[2] = 155;
  PIN[3] = 5;
  MIN[3] = 0;
  MAX[3] = 179;
  INITANGLE[3] = 25;
  for (int i = 0; i < SERVOS; i++){
    value[i] = 0;
    idle = 0;
void move_bt(){ 
  for (int i = 0; i < SERVOS; i++){
    currentAngle[i] = myservo[i].read();
    if (servo_moving[i] != 0){
      currentAngle[i] += servo_moving[i];
      currentAngle[i] = currentAngle[i] > MAX[i] ? --currentAngle[i] : currentAngle[i];
      currentAngle[i] = currentAngle[i] < MIN[i] ? ++currentAngle[i] : currentAngle[i];
void checkSoftSerial() {
  String str = "";
  if (mySerial.available()){
    for (int i = 0 ; i < 2; i++){
      str += (char); 
    // the servo to move
    int value = str.toInt();
    bt_servo = value / 10;
    // the direction to move
    int angle = value % 10;
    if (angle == 2) bt_move = 1;
    else if (angle == 1) bt_move = -1;
    else bt_move = 0;
    servo_moving[bt_servo] = bt_move;
void move_joy(){
  for (int i = 0; i < SERVOS; i++){
    value[i] = analogRead(i);
    currentAngle[i] = myservo[i].read();
    if (value[i] > 612) {
      idle = 0;      
      if (currentAngle[i] > MIN[i]) --currentAngle[i]; 
    } else if (value[i] < 412) {
      idle = 0;
      if (currentAngle[i] < MAX[i]) ++currentAngle[i]; 
    } else {
    if (idle == 100){
  for (int i = 0 ; i < SERVOS; i++){
    if (!myservo[i].attached()) myservo[i].attach(PIN[i]);
void auto_mode(){
  for (int i = 0; i < 2; i++){
    armfromto(afrom, ato);
    armfromto(ato, amiddle);
    armfromto(amiddle, afinal);
    armfromto(afinal, aafterfinal);
    armfromto(aafterfinal, afrom);
void armfromto(int *arrf, int *arrt){
  int lp[3], seg = 3, sign;
  for (int i = 0; i < 3; i++){    
    lp[i] = abs((arrt[i] - arrf[i])/seg);
  for (int i = 0; i < 3; i++){
    sign = arrt[i] - arrf[i] > 0 ? 1 : -1;
    for (int j = 0; j < lp[i]; j++){
void closeclaw(boolean op){
  if (op){
  } else {
Posted on Leave a comment

4DOF arduino Robotic arm ps2 mg90s SNAM2000 SNAM1900 Manual


install the ps2 rocker on the acrylic

please see the detail photo

2. connect the servo to v5 expansion board and test

because we already upload the code to arduino uno

3.install the acrylic arm with servo

click here

4.code download

click here

FAQ to install driver ch340 for arduino

please read:CH340 Windows Driver Download and Installation Guide

2. how to upload code to arduino

please read:Program An Arduino In A Few Simple Steps

or :Arduino Tutorial lesson 1


create on:2017.12.24

Posted on Leave a comment


Step 1

install the robot arm and remote control

please read the blog showing below:

SNARM acrylic parts install guide

Step 2

use PS2 expansion board control the arm

4 pieces servo connection:

Arm bottom-0 left servo-1 right servo-14 paw servo-15

motor connection:

power supply:

4pcs AA battery box –power for sevo 5v

2pc 18650 battery box with DC male plug-arduino uno DC port

B:Arduino PS2 expansion board Manual

code to use:

open file “PS2X_ArmCar_Shield.ino”, and upload to arduino board.


step 3

install robot arm to tank chassis

use two long screw to make fast the robot arm on tank….