Heltec Lora V2 I2C Pins Fun

I seem to be filling the blog with items about the difference between versions 1 and 2 of an embedded controller. But then again, someone might find this useful.

Anyhoo, my shiny new Heltec devices have broken another part of my Air Quality sensor, but this time in a good way. When I was using the previous version of the device I had to use to additional pins to implement the I2C connection to the BME280 environment sensor. In the new version we can use the same I2C connections as the OLED display, i.e. pin 15 for SCL and pin 4 for SDA. This works fine as long as you initialise the OLED panel before you initialize any other I2C devices.

Using the existing I2C controller frees up a pair of precious pins. You also get the benefit of a new Heltec version 2 feature. The device has two 3.3V outputs that can be controlled via pin 21. This means that your program can switch off the power to connected devices before entering deep sleep mode. You could also use this to perform a hardware reset of any connected device by turning its power off and on again. The power pins can’t deliver a huge amount of current, but it is nice to be able to control them in this way.