Arduino i2c Firmata

I have searched for hours but for the life of me can not find any information on using i2c with arduino, my end goal is to use a bme250 using arduino...

Current setup, ATMega using esp8266 for wifi, i can read and write pins.

How do i add the bme sensor to the flow?

I've no idea whether you can use I2C with Firmata. Typically, you will write some simple custom Arduino code that uses a suitable library for your sensor.

I assume that, as you are using an attached ESP8266, you are also able to use networking on the Arduino. That means that you can simply add an MQTT library as well to make communication from the Arduino to Node-RED nice and simple.

the firmata library claims it works with i2c. but i dont know where to look for more information or create custom code. all the information i find is .js code and dont know where to put it and all information refers to a raspberry pi

Also, No networking. Using the ESP8266 as a wifi serial adapter. No networking on the mega

It isn't clear to me what devices you have and how they are interconnected and are to communicate with each other. Can you explain that in more detail please.

Unless the Firmata node already supports it, it would need amending. Not sure who is the author - is it a core node? I don't use it.

How is that then consumed on the Pi side? Seems like a bit of a waste of an ESP8266 :grinning:

Take a look at ESPeasy. Install it on the arduino, install MQTT on the Pi (or use another broker that you have installed) It will handle a bme280 sensor fine (I have several WeMos D1 Minis with BME280, DS18B20's or other sensors attached)

The ESPeasy device will send the data - at the interval you set - vie MQTT and you add a MQTT-on node to receive the data. Very simple once you get the process of installing ESPeasy down.

People are getting confused... My connections are;

PC, Debian 9 <------> Wired network <----> Wifi Router <----> ESP8266 <---> Arduino Mega <---> i2c Sensors

PC Running;
Node-Red
And many others

ESP8266 Running;
ESP-Link (Turning the esp8266 into a serial server and connected to the Arduino by serial port 3)

Mega 2560 running;
firmata plus firmware

I2c sensors;
BME280, Light, Air Quality, and others.

I have successful communication to the Arduino and can read write and update by the wifi from the PC.

Problem: No I2c Documentation for Arduino i2c through firmata, Only documents reference Raspberry Pi

What I want: Links to documents/web pages on how i2c works over firmata and arduino, shared experience of how to perform i2c communications through Arduino.

What I don't want: Links to documents/web pages on i2c with Raspberry PI. How to use firmata on Raspberry PI.

I think you need to find an Arduino forum to ask questions about that.

@cymplecy
Even though all the code is written in Node-Red using Node-Red library's ?

The node-red-node-arduino doesn't support i2c. The node-red-contrib-gpio node may do, but may not in the config you have (but worth a try to find out). But the most common arrangement as others have suggested is espeasy or tasmota on the esp with the sensor connected directly (no arduino)

1 Like