Hi Arduino Experts!
I have a question regarding the I2C Speed Modes on my MKR WiFi 1010.
I would like to connect the BeeCounter Module (developed by Thorsten Gurzan - Bienenzähler (Reflexlichtschranken) - Arduino Datenlogger mit Stockwaage für Imker) to my MKR WiFi 1010 and later to my MKR GSM 1400 Arduinos. I powered the BeeCounter Module with a extra 3,3V Breadboard Power Supply and interconnect the GND from the MKR and the BeeCounter (common GND). A MCP23017 GPIO Multiplexer is the main part on the BeeCounter Module. The I2C Bus is used for the communication with the MKR WiFi 1010 Board. See the attached picture below.
The I2C was used in 100kHz Mode and all works great. I simulate a Bee and the Serial Monitor shows me what sensor was triggered and counts the Bees (Bienen in German) correct!
(I tested with sensor 1, 2 and 3)
10 00 00 00 00 00 00 00 --- BienenIn: 1 BienenOut: -1
00 00 00 00 00 00 00 00 --- BienenIn: 1 BienenOut: -1
00 10 00 00 00 00 00 00 --- BienenIn: 2 BienenOut: -1
00 00 00 00 00 00 00 00 --- BienenIn: 2 BienenOut: -1
00 00 10 00 00 00 00 00 --- BienenIn: 3 BienenOut: -1
00 00 00 00 00 00 00 00 --- BienenIn: 3 BienenOut: -1
But when I activate the Arduino IoT Cloud with this command
void loop() {
ArduinoCloud.update();
….
I will run into a strange Problem. The I2C Bus was now operated with 1MHz and the MCP23017 response with nonsense. When I trigger the Sensor 1, 2 and 3 again, I got this output:
10 10 10 10 10 10 10 10 --- BienenIn: 8 BienenOut: -1
00 00 00 00 00 00 00 00 --- BienenIn: 8 BienenOut: -1
10 10 10 10 10 10 10 10 --- BienenIn: 16 BienenOut: -1
00 00 00 00 00 00 00 00 --- BienenIn: 16 BienenOut: -1
10 10 10 10 10 10 10 10 --- BienenIn: 24 BienenOut: -1
00 00 00 00 00 00 00 00 --- BienenIn: 24 BienenOut: -1
On my Scope I see a strange Spike from the MCP23017...
The MCP23017 Datasheet explains that the Speeds 100 kHz, 400 kHz and 1.7 MHz are supported.
The D21G18 Microcontroller from the MKR supports 100 kHz, 400 kHz, 1 MHz and 3.4 MHz.
So, I expect the MCP23017 does just not work with a 1MHz SCL Clock Rate, right?
Why was the MKR I2C Bus clocked with 1MHz when activating ArduinoCloud.update();?
Is it possible to use IoT but with 100KHz I2C Speed?
All help is welcome!
Thanks a lot Andreas
PS: I have also appended the Sketch - BeeCounter Sketch.txt
BeeCounter Sketch.txt (4.09 KB)