Hi
I have a Mega 2560 example I would like to get working on the esp32. Would like to firstly know if this could be done and maybe some pointers on how I can achieve this.
thankspH_I2C.ino (6.1 KB)
Hi
I have a Mega 2560 example I would like to get working on the esp32. Would like to firstly know if this could be done and maybe some pointers on how I can achieve this.
thankspH_I2C.ino (6.1 KB)
Do you get any errors when you compile the code for ESP32 ?
none, on the mega I can send commands via serial monitor and it responds normally. on the esp32 I get nothing from trying to send commands
this code below sends/receives via the esp32 fine.
ph_i2c_esp32.ino (1.9 KB)
The call
Wire.begin(); //enable I2C port.
uses the hardware I2C-interface which on an ESP32 is
SCL on GPIO22
SDA on GPIO21
So I estimate the hardware is not connected the right way.
I2C needs 4,7kOhm Pullup-resistors. So you have to check if the Arduino Mega 2560 has these pullups on board or your I2C-device has the 4,7kOhm Pullup-resistors already connected.
If not you would have to add them.
The program is pretty short and easy. Anyway I would use the I2C-scanner-demo-code first to see if your device responds at all.
a deviceadress of 99 is rarely seen. Are you sure that this is the right I2C-adress?
99 is correct. the 2nd file I uploaded works fine. im using a sparkfun thing plus esp32 wroom SparkFun Thing Plus - ESP32 WROOM (Micro-B) - WRL-15663 - SparkFun Electronics plugged into the Qwiic connector (12c port)
the libraries that are used in the second sketch are not common.
So just take a look into them what is different in relation to your first sketch. I will not go searching for those libraries. If I eventually will take a look into them you have to provide them
best regards Stefan
The first sketch uses serialEvent()
which the ESP32 core does not support.
Use if (Serial.available() > 0) { ... }
inside loop()
instead.
It was my own decision to write an answer based on a lot of assumptions. Most of my assumptions were wrong. My own fault.
I invested time in describing non-relevant details.
I will right now after posting this message write a three letter hotstring for Autohotkey that types out a message "please describe in detail what hardware are you using .. " etc.
best regards Stefan
im using EZO™ pH Circuit | Atlas Scientific & Electrically Isolated EZO™ Carrier Board | Atlas Scientific
I will give it a shot, cheers
the ph-meter offers UART-mode. IMHO this is easier to use
best regards Stefan
need i2c only for other reasons
thank you sir, this has worked!!
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.