Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting I2C stuff #2

Open
nicolasdb opened this issue Aug 20, 2022 · 13 comments
Open

Connecting I2C stuff #2

nicolasdb opened this issue Aug 20, 2022 · 13 comments

Comments

@nicolasdb
Copy link
Owner

https://docs.m5stack.com/en/unit/envIII

And example but for M5 ATOM. I didn't find anything about stamp C3 for now.
https://www.hackster.io/hague/m5atom-env-mini-data-monitor-026469

basically, this is what I want to do, but with other hardware ^^'

https://randomnerdtutorials.com/esp32-data-logging-temperature-to-microsd-card/
image

CJMCU-758 + ESP32 measuring current
https://www.youtube.com/watch?v=alAly-oTha0

@nicolasdb
Copy link
Owner Author

@nicolasdb
Copy link
Owner Author

nicolasdb commented Aug 20, 2022

Back to basics:
Communication ESP32 I2C
https://randomnerdtutorials.com/esp32-i2c-communication-arduino-ide/

I'll try to connect in I2C:

  • a display OLED GME12864
  • the ENV III Unit with SHT30 + QMP6988

according to its datasheet any GPIO can be used for I2C.

The SDA and SCL lines are active low, so they should be pulled up with resistors. Typical values are 4.7k Ohm for 5V devices and 2.4k Ohm for 3.3V devices.

4.7K since here ENV III is 5V

@nicolasdb
Copy link
Owner Author

Instead of connecting real gadgets to your Arduino IDE compatible microcontroller board for showing experiment results (or for getting simple input like clicking), you can make use of DumbDisplay for the purposes -- to realize virtual IO gadagets on your Android phone.

https://github.com/trevorwslee/Arduino-DumbDisplay

@nicolasdb
Copy link
Owner Author

nicolasdb commented Aug 22, 2022

A ESP32-C3 I2C OLED Project

It work with 0.96 i2c oled
https://github.com/monoliths-uni/ESP32-C3-IIC-OLED

https://passionelectronique.fr/ecran-oled-i2c-arduino/

Oled is working but not by default since the I2C pin are by default.
Must add this in my case:

#define I2C_SDA 6
#define I2C_SCL 7

and this in setup:
Wire.begin(I2C_SDA, I2C_SCL);

generator bitmap Arduino

https://javl.github.io/image2cpp/

image

working with Oled 0.96 submenu

https://home.et.utwente.nl/slootenvanf/2019/11/15/using-oled-display-with-arduino/

@nicolasdb
Copy link
Owner Author

Let's try with pin 6,7 with 4.7k.

image

@nicolasdb
Copy link
Owner Author

nicolasdb commented Aug 22, 2022

Lib to install :

  • M5unit-ENV
  • Wire
  • M5gfx

I2C scan? YES

Let's try with pin 6,7 with 4.7k.

Scanning...
I2C device found at address 0x3C
done

Let's try on PORT A with pin 1,0

Scanning...
I2C device found at address 0x44
I2C device found at address 0x70
done

Everything connected on the same BUS

Scanning...
I2C device found at address 0x20
I2C device found at address 0x3C
I2C device found at address 0x44
I2C device found at address 0x70
done

MCP > 0x20
OLED > 0x3C
QMP6988 ?
SHT30 ?

@nicolasdb nicolasdb changed the title Connecting ENV III Sensor Connecting I2C stuff Aug 22, 2022
@nicolasdb
Copy link
Owner Author

nicolasdb commented Aug 23, 2022

of course, nothing works. dedjeu

However, if you’re using libraries to communicate with those sensors, this might not work and it might be a bit tricky to select other pins. That happens because those libraries might overwrite your pins if you don’t pass your own Wire instance when initializing the library.

bon, il n'y a pas de raccourcis à la connaissance...

let's get back in theory
https://deepbluembedded.com/esp32-i2c-tutorial-change-pins-i2c-scanner-arduino/

@nicolasdb
Copy link
Owner Author

nicolasdb commented Aug 23, 2022

image
PORT A [1,0] > M5 ENVIII unit
Pin [6,7] > oled 12864 + MCP

I got the "blink" to work on MCP23017 through PIN 6,7 as I2C PORT
But to work using Two I2C Bus Interfaces, or more...
TwoWire command doesn't work with Adafruit_MCP23X17 lib.

@nicolasdb
Copy link
Owner Author

Env III unit

QMP6988 for pressure
SHT30 for temp and humidity.

Download the SHT30 sensor library from the link below and then install. (It is the same as SHT31)

@nicolasdb
Copy link
Owner Author

nicolasdb commented Aug 31, 2022

YUS!

Finaly made it work, with a DHT11 from keyestudio and the old dht11 library downloaded from their link.
Doc : https://wiki.keyestudio.com/Ks0034_keyestudio_DHT11_Temperature_and_Humidity_Sensor
Lib : https://fs.keyestudio.com/KS0034
image

The code is here:
https://github.com/nicolasdb/M5Stamp-C3U/blob/OledDHT11/src/main.cpp

@nicolasdb
Copy link
Owner Author

nicolasdb commented Sep 5, 2022

ESP32 BLE + Android + Arduino IDE = AWESOME

https://www.instructables.com/ESP32-BLE-Android-App-Arduino-IDE-AWESOME/

@nicolasdb
Copy link
Owner Author

MCP23017

Expand + 16 GPIO, but digital only.

image

@nicolasdb
Copy link
Owner Author

nicolasdb commented Sep 11, 2022

image

image

waterlevel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant