I2c protocol

Hi, can iI use i2c protocol to create my project with my raspberry pi b? In the app there is only a gpio.

ye, please use virtual pins.
P.S. Our Node.js libraary is recommended for use now: https://www.npmjs.com/package/blynk-library

I have installed i2c protocol, it work but… Now when I use virtual pin for my project don’t work. Can you help me please?

Can you please post your code and some details of your setup? That way it is easier for us to look for any issues. Tnx :slight_smile:

i have a raspberry pi B ver2 with i2c module (mcp23017) . i need to use this module to control a relay board, but i don’t no if is possible to use i2c module with blynk. if i use a command line it works, but when i use blynk don’t work. what i need to do this?

For raspberry and other Linux-based boards, I suggest using our Node.js library. It’s much simpler to code.

I have a Control Everything Relay 8 Channel relay board connected to Particle Electron, how can I control the relays with Blynk?

@vshymanskyy, can you please respond to my question?

“I have a Control Everything Relay 8 Channel relay board connected to Particle Electron, how can I control the relays with Blynk?”


@Donwhale can you control the relay board without Blynk as this should be your starting point with all projects? Then you add Blynk functionality to your working project.

If it works without Blynk, what have you tried to add for Blynk functionality and what results do you have?

Also, why are you overtaking this topic? It looks like your question is completely out of scope

@Costas, this is presently working without Blynk. I’m able to control the Relays using CLI, Mobicle and Digistump. I dont know how to proceed with Blynk.

@vshymanskyy, the Relay Board connects to the Particle through I2C, that’s why I put it under this topic. I will appreciate if you can provide the I2C Blynk Library for Particle that can be used to control the relays.

Paste in your formatted sketch that works without Blynk.

Thanks @Costas, find the sketch below:

 /* Includes ------------------------------------------------------------------*/
#include "NCD8Relay/NCD8Relay.h"
#include "spark_wiring_print.h"

NCD8Relay relayController;
int triggerRelay(String command);

#include "cellular_hal.h",
STARTUP(cellular_credentials_set("internet.ng.airtel.com", "", "", NULL));

/* This function is called once at start up ----------------------------------*/
void setup()
	Particle.function("controlRelay", triggerRelay);

/* This function loops forever --------------------------------------------*/
void loop()

int triggerRelay(String command){
		return 1;
		return 1;
		int status = command.substring(14).toInt();
		if(status < 0 || status > 255){
			return 0;
		Serial.print("Setting bank status to: ");
		return 1;
	//Relay Specific Command
	int relayNumber = command.substring(0,1).toInt();
	Serial.print("relayNumber: ");
	String relayCommand = command.substring(1);
		Serial.println("Turning on relay");
		return 1;
		return 1;
		return 1;
		return 1;
	return 0;
1 Like

@Donwhale have you tried the 01_PARTICLE.INO example in the Particle Web IDE?

If you are new to Blynk you need to try the basics first.

Link for the sketch if you can’t find it in the IDE is https://github.com/vshymanskyy/blynk-library-spark/blob/master/firmware/examples/01_Particle/01_Particle.ino

@Costas, I have tried the 01_PARTICLE.INO sketch, and I was able to control the physical Pins, and also used the gauge widget to read analogue sensor. But since the Control Everything relay is connected through I2C, i understand that I needed to use Virtual Pins, that is the part I do not know how to achieve. I was thinking that there should be available Library to achieve this.

You have the library in your sketch for the relays NCD8Relay/NCD8Relay.h.

You need to read the comprehensive docs on virtual pins, remove everything from loop and use the Particle equivalent of SimpleTimer to call functions to control the relays, with Blynk buttons etc.

The timer I believe you need for your hardware is Spark Interval Timer at https://github.com/pkourany/SparkIntervalTimer

@Donwhale, did you ever get this working. i have an ncd8relay controller running the MCP23008-I2C library but would like to try the NCD library as im having delay issues with the electron. it worked fine with the photon.