All posts by Manoj R. Thakur

About Manoj R. Thakur

In 2014 I started contributing to Open Source electronics, and life has just gotten better from there. Founder of Maven Technologies.

Arduino Error avrdude: stk500_getsync(): not in sync: resp=0x00

Many new people find this error avrdude: stk500_getsync(): not in sync: resp=0x00 while uploading program to board.

Before we start to conclude the error first know how arduino works.

What is Arduino IDE?

Arduino IDE is a special software running on your system that allows you to write sketches (synonym for program in Arduino language) for different Arduino boards. The Arduino programming language is based on a very simple hardware programming language called processing, which is similar to the C language.

What is the programming language for Arduino?

In fact, you already are; the Arduino language is merely a set of C/C++ functions that can be called from your code. Your sketch undergoes minor changes (e.g. automatic generation of function prototypes) and then is passed directly to a C/C++ compiler (avr-g++).

How Arduino Program upload works?

Arduino board is basically consists of main three components.

  1. ATmega328p or similar
  2. USB to Serial Converter
  3. 5V Power supply

In most cases program is uploaded using usb cable or using external usb to serial converter.

arduino with bootloader

Error Reason 1: Blank ATmega328p Chip

When u buy fresh micrcontroller such as ATmega328p from market. It is completely blank. To program using arduino you need USB-ASP (SPI based programmer) shown below.

Reason 1: You are trying to program using serial of arduino to a blank controller.

Flashing Arduino boot-loader to fresh ATmega328p.

  1. Connect usbasp programmer to arduino.
  2. Select Board from Tools>>Boards>>Arduino UNO
  3. Select programmer usbAsp from Tools>>Programmer>>USBASP
  4. Click on Tools >> Burn Bootloader

After uploading bootloader you can use serial port / usb to program your arduino.

Error Reason 2: Power Supply

When using external USB2Serial converter, May be you have not connected +5V to microcontroller or Incorrect connections of Rx TX.

Error Reason 3: External Device on Rx Tx Line

You have connected external device on Rx Tx pin i.e. Arduino Pin 0 and Pin 1.

Remove or Disconnect any circuit present on Rx Tx lines and try again.

Error Reason 4: Wrong Selection of Port

You have selected incorrect Serial Port. Go to Tools>>Ports Menu and select proper port.

or Incorrect board selection.

Error Reason 5: Missing Drivers

If you will not find correct serial port, check that you have installed correct USB to Serial converter or Arduino Drivers. for windows look for any yellow sign (indicates error) on Serial ports.

For linux see this

Common solutions to correct the error

  • Disconnect and reconnect the USB cable.
  • Press the reset button on the board.
  • Restart the Arduino IDE.
  • Make sure you select the right board in Tools ► Board ►, e.g. If you are using the Duemilanove 328, select that instead of Duemilanove 128. The board should say what version it is on the microchip.
  • Make sure you selected the right port in Tools ► Serial Port ►. One way to figure out which port it is on is by following these steps:
    1. Disconnect the USB cable.
    2. Go to Tools ► Serial Port ► and see which ports are listed (e.g. COM4 COM5 COM14).
    3. Reconnect the USB cable.
    4. Go back to Tools ► Serial Port ►, and see which port appeared that wasn’t there before.
  • Make sure digital pins 0 and 1 do not have any parts connected, including any shields.

Error Reason 6: Damaged controller

Unfortunately, it can also mean that you burned your microcontroller. Were you doing anything dangerous right before you tried to upload a new sketch?

Error Reason 7: Using External USB to Serial converter

When using external USB to serial converter you need to connect RTS pin of usb2serial converter to reset pin of micro-controller through a 0.1uF (104) capacitor.

You need four pins from external serial converter RX, TX, GND and RTS —||— with 0.1uF capacitor connect one terminal of capacitor to RTS pin and another to reset pin of micro-controller.

Error Reason 8: Windows 10 permission

Try running Arduino IDE in administrator mode.

Error Reason 9: External Crystal is missing or faulty

Check that Most of the Arduino boards use 16MHz or 8MHz crystal, If you are trying with fresh chip, this is common mistake. Use 16MHz crystal for ATmega328p with Arduino UNO boot-loader

These are the most common mistakes that cause error avrdude: stk500_getsync(): not in sync: resp=0x00

ESP32 Internal Temperature Sensor Example

ESP32 has on chip temperature sensor, This sensor is not usable to monitor external temperature, It is used to monitor its core temperature. In this tutorial we are monitoring on chip temperature sensor data.

Update: The temp sensor is obsolete on most of the ESP32. 

ESP32 Internal Temperature Sensor

Arduino Code for ESP32 Internal Temperature Sensor

/* 
 *  https://circuits4you.com
 *  ESP32 Internal Temperature Sensor Example
 */

 #ifdef __cplusplus
  extern "C" {
 #endif

  uint8_t temprature_sens_read();

#ifdef __cplusplus
}
#endif

uint8_t temprature_sens_read();
//====================================================
//         Setup
//====================================================
void setup() {
  Serial.begin(115200);
}

//====================================================
//         Loop
//====================================================
void loop() {
  Serial.print("Temperature: ");
  
  // Convert raw temperature in F to Celsius degrees
  Serial.print((temprature_sens_read() - 32) / 1.8);
  Serial.println(" C");
  delay(1000);
}

Results

Open Serial monitor at baud rate of 115200 and see the temperature of chip.

Example shows 53.33 ° C because the function just returns 128 (sensor not present).

ESP32 Internal Hall Sensor Example

ESP32 comes with in build hall sensor, this sensor can be used to detect presence of magnet, Like door sensor. In this tutorial we will see how to read its value and detect presence of magnet.

A Hall effect sensor is a transducer that varies its output voltage in response to a magnetic field. Hall effect sensors are used for proximity sensing, positioning, speed detection, and current sensing applications.[1]

ESP32 Internal Hall Effect Sensor

Continue reading ESP32 Internal Hall Sensor Example

ESP32 Hardware Serial2 Example

There are three serial ports on the ESP32 known as U0UXD, U1UXD and U2UXD all work at 3.3V TTL Level. There are three hardware supported serial interfaces on the ESP32 known as UART0, UART1 and UART2. Like all peripherals, the pins for the UARTs can be logically mapped to any of the available pins on the ESP32. However, the UARTs can also have direct access which marginally improves performance. The pin mapping table for this hardware assistance is as follows.

UART RX IO TX IO CTS RTS
UART0 GPIO3 GPIO1 N/A N/A
UART1 GPIO9 GPIO10 GPIO6 GPIO11
UART2 GPIO16 GPIO17 GPIO8 GPIO7

Having said that, the UART drivers that I recommend to use don’t have this level of optimization built into them and as a result, you are pretty much free to use any pins you choose. Continue reading ESP32 Hardware Serial2 Example

ESP32 Capacitive Touch Pad Example

Introduction

A touch-sensor system is built on a substrate which carries electrodes and relevant connections under a protective flat surface. When a user touches the surface, the capacitance variation is triggered and a binary signal is generated to indicate whether the touch is valid.

ESP32 can provide up to 10 capacitive touch pads / GPIOs. The sensing pads can be arranged in different combinations (e.g. matrix, slider), so that a larger area or more points can be detected. The touch pad sensing process is under the control of a hardware-implemented finite-state machine (FSM) which is initiated by software or a dedicated hardware timer.

Continue reading ESP32 Capacitive Touch Pad Example