Arduino Uno with Ethernet shield INPUT/OUTPUT to Blue Iris.

Mattias

Young grasshopper
Joined
Nov 1, 2015
Messages
35
Reaction score
8
I’ve made a program for the Arduino with Ethernet shield that can trigger Blue Iris from an Arduino I/O. Blue Iris can also trigger the Arduino through “request from a web service” in the alert menu in Blue Iris.

Blue Iris web server should be on. Not 100% sure exactly what settings that is needed but I have uncheck the “secure only” and Authentication is set to Non-LAN only.

The Arduino program need some adaptation to work in your application. I’ve comment that line with “// Change this” in the program.

Right now the function is like this.
I/O 2,3,5,6 on the Arduino is digital inputs. (If input is high it will retrigger after 10 sec so break time in Blue Iris should be longer than 10 seconds). (I/O 4 and 10-13 I think is occupied so don’t use those)
Digital Input 2 on the Arduino will trigger the camera named “Cam1” in Blue Iris.
Digital Input 3 on the Arduino will trigger the camera named “Cam2” in Blue Iris.
Digital Input 5 on the Arduino will trigger the camera named “Cam3” in Blue Iris.
Digital Input 6 on the Arduino will trigger the camera named “Cam4” in Blue Iris.

I/O 7,8,9 on the Arduino is digital Outputs.
These will be triggered if the following settings are done in the “request from a web service” for the specific camera in Blue Iris. See picture attached and explanation below.
“When triggered”: put in the IP-number of the Arduino, in example (192.168.1.157)
“POST text”: Out07=On
Check “Request again….”
“POST text”: Out07=Off

I manage to get this working with copy paste from different project, and I don’t fully understand all the code but I manage to get it working for me anyway. So use on your own risk. Probably there is smarter ways of programming this and if anyone wants to improve the code please do that.
 

Attachments

eeeeees

Young grasshopper
Joined
Jan 14, 2016
Messages
62
Reaction score
19
Hello Mattias
I downloaded your sketch ethernet_BlueIris_HTTP.ino and compiles and runs OK on my hardware. It works with BI in that it communicates both to and from BI. Because of shields I am using I need both the Arduino inputs and outputs inverted. Sounds simple but with my limited programming skills I have not been able to figure it out. Your help with the code would be appreciated.

Separately: Where does this IP go "192.168.1.9"; in BI

EthernetClient client;
char BIserver[] = "192.168.1.9"; // IP Adres of Blue Iris Server. // CHANGE THIS

char user[]= "Usernamn"; //Username for Blue Iris Server // CHANGE THIS
char pass[]= "Password"; //Password for Blue Iris Server // CHANGE THIS
String stringOne = "camera";

BI does not allow me to change the Interfaces: box on the Web server tab. Both it and the https:// box are stuck on the IP address of my local machine. I can put the cursor in the box but not change the address.
Capture.PNG

Thanks again for this useful sketch, it does exactly what I need.
Eric
 

Mattias

Young grasshopper
Joined
Nov 1, 2015
Messages
35
Reaction score
8
HI

Se my answers below.



Hello Mattias
I downloaded your sketch ethernet_BlueIris_HTTP.ino and compiles and runs OK on my hardware. It works with BI in that it communicates both to and from BI. Because of shields I am using I need both the Arduino inputs and outputs inverted. Sounds simple but with my limited programming skills I have not been able to figure it out. Your help with the code would be appreciated.


For Inputs to the Arduino change the following in the "void digital_read()" function.
input = digitalRead(2); // read digital input I/O value on Arduino.
if (input == HIGH) { // check if the input is HIGH
DI02 = 1;
}
else {
DI02 = 0;
}

TO
input = digitalRead(2); // read digital input I/O value on Arduino.
if (input == LOW) {
DI02 = 1;
}
else {
DI02 = 0;
}


For Outputs to the Arduino change the following in the "void writedigital()" function.
if ( strncmp( new_state, "Out07=On", 8) == 0 ) {
digitalWrite(7, HIGH);
}
else if ( strncmp( new_state, "Out07=Off", 9) == 0 ) {
digitalWrite(7, LOW);
}

TO
if ( strncmp( new_state, "Out07=On", 8) == 0 ) {
digitalWrite(7, LOW);
}
else if ( strncmp( new_state, "Out07=Off", 9) == 0 ) {
digitalWrite(7, HIGH);
}


And you need to set the output high in the "void setup()" so you start the arduino with HIGH output pins.

You need to change this for all of the inputs and outputs...




Separately: Where does this IP go "192.168.1.9"; in BI


This you should change in the Arduino program, this is the IP-adress to your computer running the Blue Iris web server. In your case you should change this to 192.168.1.50, this is needed for the Arduino to have the possiblity to trigger cameras.
 

KiwiME

n3wb
Joined
Sep 17, 2015
Messages
12
Reaction score
1
Location
New Zealand
Just got this working myself. One other reason to configure the inputs as active-low is that ones that are left disconnected are significantly more immune to noise with the internal pull-ups.
 

eeeeees

Young grasshopper
Joined
Jan 14, 2016
Messages
62
Reaction score
19
Hello Kiwi

Attached inline is a write up of how I did the project:

View attachment IOT Box.pdf
You are right about the internal pull-ups, direct input should never be used when interfacing to the outside world. It's a cruel place out there and the Arduino will last about a day. All that wire is nothing but a big antenna and a local FM station will look like data to be processed! The one thing about using a normally-closed contact for the sensor output/s (high true as an Arduino digital input) is that a failure of the sensor wiring (like has been cut) will cause an alert. This is stand burglar alarm good practice even if I did not follow it.

Have fun, Eric
 
Joined
Sep 4, 2015
Messages
1
Reaction score
1
Good morning to everybody.
I am a new member, i am realizing an industralized version of IOT BOX described above, with a motherboard, with mounted Arduino NANO , Ethernet shield ENC28J60 and 4 out relay module, meanwhile the motherboard has 12 inputs, isolated power supply , RS485(for future use) diagnostic led, external selector to configuere the board.
The board is running ok, and Bluiris activate a relay , using Web service function.Since i have to migrate software from W5100 to ENC28J60, i am rewriting the protocol to trigger the camera related to each sensor input from TCP/IP command generate by Arduino. But i ask to have , if possible, to have more information about string must send to Bluiris to trigger camera. Please can hel me, to find more documentation about this command?
For example string format? Where do i set username and password on Bluiris? Is it possible to change port on Blue Iris web server?
When the project is finished, i will post with software, electric diagram and PCB files to condivide with everybody
Thanks
Andrea

I am referring to this arduino code
void triggerBI(){ // sending the trigger to Blue Iris web-server
EthernetClient client;

if (client.connect(BIserver, 81)) { // (81) Port number of the Blue Iris web server //CHANGE THIS if you don't use port 81.
// Make a HTTP request:
client.print( "GET /admin?camera=");
client.print(stringOne);
client.print( "&trigger&user=");
client.print( user);
client.print( "&pw=");
client.print( pass);
client.println( " HTTP/1.1");
client.print( "Host: " );
client.println(BIserver);
client.println( "Connection: close" );
client.println();
client.println();
client.stop();
 

eeeeees

Young grasshopper
Joined
Jan 14, 2016
Messages
62
Reaction score
19
Hello Dereck
If you go to my project file in the post above, IOT Box.pdf it may give you some feel for the BI commands. I didn't do the code only the hardware. Code was by Mattias, I just hacked it slightly to make it work for me. Search the archives on Arduino and on Digitial I/O, you will find more.
Good Luck and keep us posted.
Eric
 
Joined
Jan 27, 2018
Messages
7
Reaction score
0
Hi
I am not a coder but have copied you sketch and made the necessary changes
I can see the arduino logging on to BI but it isnt triggering the camera to record
I know the PIR sensor is working and turning pin2 high
what is preventing the recording triggering?
thanks in advance
Richard
 
Joined
Jan 27, 2018
Messages
7
Reaction score
0
Hi
yes Admin rights and under record the video is ticked ...when triggered

however, I have noticed the arduino shield has disconnected from the LAN since last night and is not reconnecting automatically when the PIR is being triggered

I gave the device a fixed ip address so there shouldn't be any issues there with dhcp
 
Joined
Jan 27, 2018
Messages
7
Reaction score
0
I have managed to get the ethernet shield back online by pinging it but still not connecting as a client in BI
 
Joined
Jan 27, 2018
Messages
7
Reaction score
0
I can see in messages that local console has logged in and connected plus a third message saying server connected with the ip address I gave the arduino
 

KiwiME

n3wb
Joined
Sep 17, 2015
Messages
12
Reaction score
1
Location
New Zealand
I snipped the response I get, see photo, the camera name is pump. I only use the external trigger for iOS alerts, which stopped working properly months ago and now don't appear until I enter the app, or totally randomly.

My last suggestion is that you might try running Ethernet.maintain(); about every 1 second even if it's not theoretically necessary for a static IP.
 

Attachments

Joined
Jan 27, 2018
Messages
7
Reaction score
0
Hi
The good news is the Arduino is now staying connected once I added the line. The bad news is that it isnt working and I dont know why
Richard
 

MrGlasspoole

Young grasshopper
Joined
Mar 10, 2018
Messages
66
Reaction score
17
What are you guys exactly doing when you connect a microprocessor to the Blu Iris machine?

I saw BI has MQTT build in so i see no reason to connect a Arduino directly.
 

MrGlasspoole

Young grasshopper
Joined
Mar 10, 2018
Messages
66
Reaction score
17
ot? You mean MQTT?

Thats something i really like. I don't know what others do to videos with sensors...
But that means it's easy for example to send something with a NodeMCU (ok, i'm not a fan of WLAN - i prefer RFM69).

My main idea was to send a image to Telegram (i don't use Whatsapp) if somebody rings the doorbell.
Or maybe open the cam on the satellite receiver (TV)...
 

fenderman

Staff member
Joined
Mar 9, 2014
Messages
36,903
Reaction score
21,275
ot? You mean MQTT?

Thats something i really like. I don't know what others do to videos with sensors...
But that means it's easy for example to send something with a NodeMCU (ok, i'm not a fan of WLAN - i prefer RFM69).

My main idea was to send a image to Telegram (i don't use Whatsapp) if somebody rings the doorbell.
Or maybe open the cam on the satellite receiver (TV)...
yes, typo...
 
Top