Go Down

Topic: IC2 sensor and Arduino Uno Wifi Card (Read 313 times) previous topic - next topic



I have a Arduino Uno Wifi Card. I have flashed the firmware following this procedure
The Wi-Fi connection is working now.

But when I try to read data from IC2 sensor (a thermal one in my case), the connection to Serial1 seems to be frozen.

Here is a part of my code  :

Code: [Select]

#include <TH02_dev.h>
#include "Arduino.h"
#include "Wire.h"
#include <UnoWiFiDevEdSerial1.h>
#include "WiFiEsp.h"

char ssid[] = "xxxxx";            // your network SSID (name)
char pass[] = "xxxxx";        // your network password
int status = WL_IDLE_STATUS;     // the Wifi radio's status
int k=0;

char postmsg[100];
// Initialize the Ethernet client object
WiFiEspClient client;

void setup()
  // initialize serial for debugging
  Serial.begin(115200); //115200
  Serial.println("****Setup TH02****\n");
  /* Thermal sensor Reset HP20x_dev */
  float temper = TH02.ReadTemperature();
  Serial.println("Temperature: ");
  // initialize serial for ESP module
  Serial.println("****Setup ESP module****\n");
  // initialize ESP module
  Serial1.overflow(); // clear the flag. after reset in init esp overflows buffer with boot log
  Serial.println("****Begin Setup****\n");
  // check for the presence of the shield
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue
    while (true);

I'm not sure to understand the section "I2C a.k.a. Wire a.k.a. TWI" of the readme of the git hub page : UNO WiFi (Developer Edition) Serial1.

Is I2C protocol working on this board?

Thanks in advance for helping me.


Dec 16, 2017, 03:06 pm Last Edit: Dec 18, 2017, 05:16 pm by Juraj
yes. the SC16IS750 (Serial1) is an I2C device, but I2C can connect multiple devices with different addresses. you can use I2C scanner sketch to list attached devices.

some older TH_02 thread

if the I2C sensor can't handle I2C 400k speed, use for WiFi Link Serial1 57600 baud. do not forget changing it in firmware config.h

edit: config.h is WiFi Link, you use AT firmware
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.


Thanks for your fast reply.
How may I change the baude rate ? Where do I find the config.h of the firmware ?
Sorry for this question which should be a basic, but I google it and I found nothing clear.


I make huge confusion between the Espressif AT firmware and the WiFi Link firmware...  :o
I will work with the right firmware should be easier. :)


Dec 18, 2017, 04:48 pm Last Edit: Dec 18, 2017, 04:50 pm by Juraj
sorry. my mistake. I see now, you have WiFiEsp library in sketch. the baud rate can be set in AT firmware too. with an AT commnand.

but the incompatibility is not firmware depended. if you read the linked thread, the sensors is a problem
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.


Thanks for the help.
I found an interesting topic using the INT pin of the sensor to disable it.


The solution with the jump wire (http://seeedstudio.com/forum/viewtopic.php?f=17&t=6240) works fine !
The jump wire goes from INT pin of the sensor to pin D5 of the arduino.

Here is the function to switch on/off the TH02 sensor in order to be able to work with other I2C devices when TH02 is switched off.

Code: [Select]

float getTemp()
  // get temp function
  // use pin number 5 ( int pin = 5 );
  digitalWrite(pin,LOW); // switch on TH02
  float temper = 0.0;
  // make 5 measurements and take the mean
  for (int i=0; i <= 4; i++){
      temper += TH02.ReadTemperature();
  temper = temper / 5.0 ;

  digitalWrite(pin,HIGH); // switch off TH02
  return temper;

Go Up