EmileRx
December 16, 2017, 1:51pm
1
Hello,
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 :
#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 */
TH02.begin();
delay(100);
float temper = TH02.ReadTemperature();
Serial.println("Temperature: ");
Serial.print(temper);
Serial.println("C\r\n");
// initialize serial for ESP module
Serial.println("****Setup ESP module****\n");
Serial1.begin(115200);
// initialize ESP module
WiFi.init(&Serial1);
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.
Regrads
Emile
Juraj
December 16, 2017, 2:06pm
2
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
EmileRx
December 18, 2017, 2:50pm
3
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.
EmileRx
December 18, 2017, 3:41pm
4
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.
Juraj
December 18, 2017, 3:48pm
5
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
EmileRx
December 20, 2017, 1:09pm
6
Thanks for the help.
I found an interesting topic using the INT pin of the sensor to disable it.
http://seeedstudio.com/forum/viewtopic.php?f=17&t=6240
EmileRx
December 21, 2017, 11:02am
7
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.
float getTemp()
{
// get temp function
// use pin number 5 ( int pin = 5 );
digitalWrite(pin,LOW); // switch on TH02
delay(150);
TH02.begin();
delay(100);
float temper = 0.0;
// make 5 measurements and take the mean
for (int i=0; i <= 4; i++){
temper += TH02.ReadTemperature();
delay(10000);
}
temper = temper / 5.0 ;
digitalWrite(pin,HIGH); // switch off TH02
delay(100);
return temper;
}