Adding support for ESP32 boards in the Arduino IDE

This is  the github instructions, I have been looking at the ESP32 module

My ESP Arduino installation is located at J:\esp on my PC but other than changing the paths everything went as planned. The board I bought was a Lolin32 from Wemos – we’ll come to that later

Tested on 64 bit Windows 10 machine (I don’t have 32 Bit)

  1. Download and install the latest Arduino IDE Windows Installer from
  2. Download and install Git from
  3. Start Git GUI and run through the following steps:
    • Select Clone Existing Repository
      Step 1
    • Select source and destination
      • Source Location:
      • Target Directory: C:/Users/[YOUR_USER_NAME]/Documents/Arduino/hardware/espressif/esp32
      • Change this to your Sketchbook Location if you have a different directory listed underneath the “Sketchbook location” in Arduino preferences.
      • Click Clone to start cloning the repository
      • Step 2 Step 3
    • Open C:/Users/[YOUR_USER_NAME]/Documents/Arduino/hardware/espressif/esp32/tools and double-click get.exeStep 4
    • When get.exe finishes, you should see the following files in the directoryStep 5
  4. Plug your ESP32 board and wait for the drivers to install (or install manually any that might be required)
  5. Start Arduino IDE
  6. Select your board in Tools > Board menu
  7. Select the COM port that the board is attached to
  8. Compile and upload (You might need to hold the boot button while uploading)Arduino IDE Example

How to update to the latest code


  1. Start Git GUI and you should see the repository under Open Recent Repository. Click on it!
  2. Update Step 1


  1. From menu Remote select Fetch from > origin
  2. Update Step 2
  3. Wait for git to pull any changes and close Git GUI
  4. Open C:/Users/[YOUR_USER_NAME]/Documents/Arduino/hardware/espressif/esp32/tools and double-click get.exeStep 4

HC-SR505 Mini PIR Motion Sensor and Arduino

The HC-SR505 Mini PIR Motion Sensor is based on infrared technology and it can automatic control by itself with high sensitivity and high reliability. Because of the minimum size and low-power operation mode, it widely used in various of automatic electronic equipment, especially battery-powered automatic products.



Operating voltage range: DC 4.5-20V
Quiescent Current: <60uA
Trigger: reusable trigger (default)
Delay Time: The default 8S + -30%
Board Dimensions: 10 * 23mm
Induction angle: <100 degrees cone angle
Sensing distance: 3 meters
Working temperature: -20 to +80 degrees
Sensor Lens Dimensions: Diameter: 10mm



Connect the PIR Motion Sensor to your Arduino power supply pin and digital pins. You can can connect the “s” terminal to any of your arduino I/O Pins




void setup() 
void loop() 
Serial.println("INTRUDER DETECTED.");
Serial.println("ALL CLEAR.");



Open the serial monitor and you should see something like




1 PCS X HC-SR505 Mini Infrared PIR Motion Sensor Precise Infrared Detector Module NEW

Arduino and MMA8653 accelerometer example

The NXP® MMA8653FC 10-bit accelerometer has industry leading performance in a small DFN package. Packed with embedded functions that include:

Flexible user-programmable options and two configurable interrupt pins
Overall power savings through inertial wake-up interrupt signals that monitor events and remain in a low-power mode during periods of inactivity


Low-profile 2 x 2 x 1.0 mm DFN package
High sensitivity: 1 mg per LSB
Low noise: 150 micro g per root Hertz (independent of resolution)
Low-power mode: 7 micro amps
Interrupt and IIC interface supply: 1.62 to 3.6 V
Supply voltage : 1.95 to 3.6 V
Output data rate: 1.5 to 800 Hz


You need to use 3.3v for this device, the rest is easy Gnd and I2C



#include <Wire.h>
// I2C BUS: already defined in "wire" librairy
// SDA: PIN 2 with pull up 4.7K to 3.3V on arduino Micro
// SCL: PIN 3 with pull up 4.7K to 3.3V on arduino Micro
// Accelerometer connected to +3.3V of arduino DO NOT CONNECT TO 5V (this will destroy the accelerometer!)
// all GND Pin of accelerometer connected to gnd of arduino
/********************ACCELEROMETER DATAS************/
// adresss of accelerometer
int adress_acc=0X1D; // MMA8653FC and MMA8652FC
// adress of registers for MMA8653FC
int ctrl_reg1 = 0x2A;
int ctrl_reg2 = 0x2B;
int ctrl_reg3 = 0x2C;
int ctrl_reg4 = 0x2D;
int ctrl_reg5 = 0x2E;
int int_source = 0x0C;
int status_ = 0x00;
int f_setup = 0x09;
int out_x_msb = 0x01;
int out_y_msb = 0x03;
int out_z_msb = 0x05;
int sysmod = 0x0B;
int xyz_data_cfg = 0x0E;
/******PROGRAM DATAS**********/
int result [3];
int axeXnow ;
int axeYnow ;
int axeZnow ;
void setup(){
Wire.begin(); // start of the i2c protocol
Serial.begin(9600); // start serial for output
ACC_INIT(); // initialize the accelerometer by the i2c bus. enter the sub to adjust the range (2g, 4g, 8g), and the data rate (800hz to 1,5Hz)
void loop()
void ACC_INIT()
I2C_SEND(ctrl_reg1 ,0X00); // standby to be able to configure
I2C_SEND(xyz_data_cfg ,B00000000); // 2G full range mode
// I2C_SEND(xyz_data_cfg ,B00000001); // 4G full range mode
// delay(1);
// I2C_SEND(xyz_data_cfg ,B00000010); // 8G full range mode
// delay(1);
I2C_SEND(ctrl_reg1 ,B00000001); // Output data rate at 800Hz, no auto wake, no auto scale adjust, no fast read mode
// I2C_SEND(ctrl_reg1 ,B00100001); // Output data rate at 200Hz, no auto wake, no auto scale adjust, no fast read mode
// delay(1);
// I2C_SEND(ctrl_reg1 ,B01000001); // Output data rate at 50Hz, no auto wake, no auto scale adjust, no fast read mode
// delay(1);
// I2C_SEND(ctrl_reg1 ,B01110001); // Output data rate at 1.5Hz, no auto wake, no auto scale adjust, no fast read mode
// delay(1); 
void I2C_SEND(unsigned char REG_ADDRESS, unsigned char DATA) //SEND data to MMA7660
void I2C_READ_ACC(int ctrlreg_address) //READ number data from i2c slave ctrl-reg register and return the result in a vector
byte REG_ADDRESS[7];
int accel[4];
int i=0; 
Wire.beginTransmission(adress_acc); //=ST + (Device Adress+W(0)) + wait for ACK
Wire.write(ctrlreg_address); // store the register to read in the buffer of the wire library
Wire.endTransmission(); // actually send the data on the bus -note: returns 0 if transmission OK-
Wire.requestFrom(adress_acc,7); // read a number of byte and store them in (note: by nature, this is called an "auto-increment register adress")
for(i=0; i<7; i++) // 7 because on datasheet p.19 if FREAD=0, on auto-increment, the adress is shifted
REG_ADDRESS[i]; //each time you read the it gives you the next byte stored. The couter is reset on requestForm
for (i=1;i<7;i=i+2)
accel[0] = (REG_ADDRESS[i+1]|((int)REG_ADDRESS[i]<<8))>>6; // X
if (accel[0]>0x01FF) {accel[1]=(((~accel[0])+1)-0xFC00);} // note: with signed int, this code is optional
else {accel[1]=accel[0];} // note: with signed int, this code is optional
case 1: axeXnow=accel[1];
case 3: axeYnow=accel[1];
case 5: axeZnow=accel[1];
void I2C_READ_REG(int ctrlreg_address) //READ number data from i2c slave ctrl-reg register and return the result in a vector
unsigned char REG_ADDRESS;
int i=0; 
Wire.beginTransmission(adress_acc); //=ST + (Device Adress+W(0)) + wait for ACK
Wire.write(ctrlreg_address); // register to read
Wire.requestFrom(adress_acc,1); // read a number of byte and store them in write received






Arduino and HS1011 humidity sensor example

The HS1101 humidity sensor is a cost-effective solution for measuring relative humidity within ±5% accuracy. The sensor’s design is based on a unique capacitive cell; therefore, by using simple RC circuit wiring it is easy to interface with any Parallax microcontroller, including the BASIC Stamp® and Propeller chip.


Power requirements: 5 to 10 VDC
Communication: Analog output of varying capacitance in response to change in relative humidity
Humidity Measuring Range: 1 to 99% RH
Operating temperature: -40 to 212 °F (-40 to 100 °C)


Connect 5v and Gnd to the module

I used Pin 6, you can use any I/O pin you will need to change the code if you do



Demonstration of the Parallax HS1101 relative humidity sensor (#27920)
The HS1101 sensor acts as a capacitor, and uses the circuit described in the 
product documentation to derive an RC (resistor-capacitor) time delay. By
measuring the decay of the capacitor through a resistor, it is possible to
obtain the current relative humidity.
This demo shows the relative humidity (accuracy: +/-3.5%, as noted in product 
documentation), along with the RC delay timing. Readings repeat once every ½ 
second, and are displayed in the Arduino Serial Monitor window.
This example code is for the Arduino Uno and direct compatible boards, using the
Arduino 1.0 or later IDE software. It has not been tested, nor designed for, other 
Arduino boards, including the Arduino Due.
Please note: Environmental factors - including use indoors or outdoors, and
above and below typical room temperature ranges -- may affect the accuracy of 
the readings. The demo includes an RCdelay calibration value that can be 
adjusted against a known working humidity sensor used in the same environment.
Important: the result is based on the clock speed of Arduino microcontroller.
Other versions of Arduino (running at faster or slower clocks) will need
recalibration of the RCdelay value. See comment below.
Refer to the HS1101 product documentation for the connection diagram and
circuit. The output of the sensor is connected to Arduino pin D4.
Tips: The sensor is sensitive to stray capacitance. Keep lead lengths short.
Results may vary when the test circuit is built on a solderless breadboard.
Leads from sensor are slightly undersized for breadboard holes. Make sure
they make adequate contact. When taking readings avoid contact or close
proximity to sensor or bare circuit wires.
int sensorPin = 4; // RC circuit with HS1101 sesnor connected to digital pin D4
long result = 0;
int const RHconstant = 12169; // RH constant
void setup() {
Serial.begin(9600); // Use Serial Monitor window at 9600 baud
Serial.println("Humidiy reading start");
Serial.print("RC delay");
void loop() {
long RCdelay = RCTime(sensorPin); // Take RC time reading of sensor
Serial.print(RCdelay); // Display RC time delay
RCdelay = RCdelay * 215; // Calibation to RC time delay; experiment with literal value
int humidity = (RCdelay - RHconstant) / 24;
Serial.println(humidity / 100, DEC); 
delay(500); // Wait 1/2 second for the next read
// Standard RC time function
long RCTime(int sensePin){
long result = 0;
pinMode(sensePin, OUTPUT); // Make pin OUTPUT, and turn HIGH
digitalWrite(sensePin, HIGH); 
delay(1); // Wait 1 ms delay
pinMode(sensePin, INPUT); // Make sensor INPUT
digitalWrite(sensePin, LOW); // Turn off Arduino internal pullup resistor
while(digitalRead(sensePin)){ // Loop until pin goes low
return result;



CJMCU-1101 HS1101 humidity sensor RELATIVE, HUMIDITY, SENSOR

Generate a QR code with an Arduino

In this example we will show how to generate a QR code, all of the hard graft is done in a library



This is the default example

 *  QRCode
 *  A quick example of generating a QR code.
 *  This prints the QR code to the serial monitor as solid blocks. Each module
 *  is two characters wide, since the monospace font used in the serial monitor
 *  is approximately twice as tall as wide.
#include "qrcode.h"
void setup() {
    // Start time
    uint32_t dt = millis();
    // Create the QR code
    QRCode qrcode;
    uint8_t qrcodeData[qrcode_getBufferSize(3)];
    qrcode_initText(&qrcode, qrcodeData, 3, 0, "HELLO WORLD");
    // Delta time
    dt = millis() - dt;
    Serial.print("QR Code Generation Time: ");
    // Top quiet zone
    for (uint8_t y = 0; y < qrcode.size; y++) {
        // Left quiet zone
        Serial.print("        ");
        // Each horizontal module
        for (uint8_t x = 0; x < qrcode.size; x++) {
            // Print each module (UTF-8 \u2588 is a solid block)
            Serial.print(qrcode_getModule(&qrcode, x, y) ? "\u2588\u2588": "  ");
    // Bottom quiet zone
void loop() {



Open the serial monitor – this is what you should see