Arduino and Omni PRO II via serial - first working code.

tigers

Active Member
The code I sent has now have been working for 6 months now, continuosly reading temperature from HAI sensors and sending them to the internet, and also reading my energy meter and sending data both to internet and to the OP II.
 
The code is now quite stable I must say; the only problem is that it's hard to sync the communication at startup, but I got around that.
If you need anything specific just ask and I'll tell you if it's doable or not and will help you to get it done.
 

jake92

New Member
That sounds great.  I would like to to learn more about what you have done.  How can I get my hands on the Arduino sketch?
 
What was the issue related to initially syncing the comms between the Arduino and the HAI panel?  Do the comms support either serial or ethernet?
 

tigers

Active Member
The core part is basically what I posted in the previous messages, there's all you need to get started. I just improved a little the HAI parsing and added the omni pro protocol on another serial to get messages sent to the arduino that trigger some actions in pushbullet so I can get notifications on my phone when something happens.

The only protocol I implemented is the serial, the ethernet one is much more complicated to code because of the encryption, and also I believe the serial connection to be more reliable.

The sync issue is mainly a coding issue: as long as the loop() doesn't start the HAI responses aren't processed so no command can be sent during setup(). I worked on that but still sometimes it gets stuck in a login retry loop. This happens only on startup so Koster of the time I am there to manually restart.

Let me know if I can help in building the serial cable, the hardware of software part.
 

pete_c

Guru
@Tiger,
 
Looking here to try your stuff and purchasing a board.  Just to recap....purchasing:
 
1 - Arduino Leonardo
2 - plastic case
3 - TTL to Serial board
 
Should I purchase an ethernet shield too?
 
I was planning on connecting it to the TP-Link device.
 
Right now in your testing how are you accessing the Arduino?
 

tigers

Active Member
Well, the plastic case is optional of course, I have it running on a breadboard currently. Also I won't suggest the Leonardo with he ethernet shield both because of some compatibility issues between the shield and the leonardo and of the fact that the ethernet library takes up a lot of RAM.
Also I don't suggest the UNO because of the serial port shared with USB, which may be awkward to deal with during debug.
Of course if you aren't interested in communicating with the outside world or getting push notifications the ethernet shield is totally optional. The TP-LINK should work fine, I'm currently using one similar with the Arduino right now for a remote thermostat project.

Summing up my personal suggestion is:
- a MEGA. You can find Chinese clones on eBay for less than 10$ and they work perfectly fine;
- the TTL to serial interface. Avoid the cheaper ones;
- ethernet shield; again, Chinese clones are available for less than 10$ and are good. Also the even cheaper ENC28J60 interfaces will work just fine and are fully code-compatible using the uipethernet library.
Once you have that we can discuss the details and start with the first applications. What are you trying to do?
 

pete_c

Guru
Thank-you Tiger.
 
Yup; then it would be easier then to use the TP-Link or Almond Plus rather to to purchase an ethernet shield.
 
1 - Arduino Leonardo
2 - plastic case (optional)
3 - TTL to Serial board
 
Is all I need to get started eh?
 

tigers

Active Member
Sorry, I have not been clear enough: the ethernet shield is mandatory if you want to connect the arduino to the Internet. The TP-LINK would work as a gateway to connect the ethernet shield to wi fi if you haven't a cable connection ready next to the HAI central. The ethernet shield has only an RJ plug and the wi fi shields are way too expensive.

That said, yes, your list is OK, get those, a PC with the Arduino IDE installed and you are ready to go.
 

pete_c

Guru
Thank you Tiger.
 
What are you trying to do?
 
Yup; here looking to duplicate your environment. 
 
Having written that then I should get:
 
1 - Arduino Mega
 
Arduino Mega.jpg
 
2 - TTL to Serial board
 
TTL.jpg
 
3 - ethernet shield
 
ethernet shield.jpg
 
4 - Data logging Shield (optional)
 
5 - Case (optional)
 

tigers

Active Member
Just 2 things:
1. The MEGA and ethernet shield are OK;
2. the TTL interface in the picture is WRONG: that one is good to convert TTL to serial and then again TO USB; with Arduino you just have to convert TTL to serial, since you are not going to a PC. So you need something like this: http://www.dx.com/p/rs232-serial-port-to-ttl-converter-module-w-transmitting-and-receiving-indicator-144192; there are cheaper ones around BUT I had great troubles with them and I really don't reccomend using them;
3. since tipically the TTL interface comes witha DB9 serial connector but the HAI instead uses RJ11 plugs for serial connection (why?!?) you need to build a DB9-RJ11 cable; HAI sells one but it's quite expensive. Personally I found an interface that had pins on both ends (serial and TTL) and connected directly;
4. the data logging shield is useless since the ethernet shield already has an SD card module on board (look in the top right corner of your picture: that's the microSD slot); it's not exactly straightforward to use, expecially on the MEGA but I did it, so you can do the same. Also, I am currently using emoncms.org services for data logging directly on the internet and at the moment I don't feel the need for a local logging; also, emoncms can be installed on a local PC or NAS so that you can do the logging directly on your local network, without the need for an SD card device;
 
Also please note that the ethernet shield is used mainly for that purpose - logging data on the cloud - and you could get everything else to work without it. As I said the communication to and from the HAI goes thru serial, I don't have the programming abilities nor the interest in using the ethernet protocol for connecting.
 
When you are ready to go contact me, we could do a Skype chat, so I can help with setting everything up properly, if you don't have much experience with Arduino you'll need help I suppose... :)
 

pete_c

Guru
Thank you Tigers!  I have no experience with the Arduino.
 
I will order the 9 pin serial RS-232  to TTL and remove the data logger shield from the order.
 
I currently am connected to the OPII panel via a serial port and the ethernet port. 
 
Both connections manage the panel.  One checks on the other for the time being. 
 

tigers

Active Member
Experience with arduino is not mandatory but you must have at least basic knowledge of programming, better if in C.

The problem with using ethernet is just a matter of coding. Arduino is perfectly capable of doing it, but the encryption protocol must be implemented and I can't do it myself. Serial has only a CRC check that I managed to implement
 

ubergeek

Member
Ok, Tigers...it was a bit of a curve at first, but  am sooo glad you sent me the links when I was looking into Arduino--->Omnipro II options. I was finally able to get an openHAB instance up using MQTT (instead of HTTP) and talking to Arduinos. I really wanted HTTP or TCP because I have an older board with only 3 serial ports however I realize I probably still could implement you r serial project as I'm not using my elve server anymore.
 
Regardless, after reviewing some of the links I really got more and more excited when looking into openHAB. Having an open source project with that large of a community is very exciting and 2.0 will prove to get even more people on board as the configuration will become more automatic. There are tons of bindings (plugins) that already tie the most popular products out there today, and many being added every month. With the omnilink binding, the board has been opened up to so many possibilities I hadn't been able to do before with my HaikuHelper or elve.
 
So just to build on the Omnipro II ---> Arduino thread...MQTT is very interesting and robust if you are interested in having several Arduinos on the network and seems to be one of the preferred messaging protocols of the future in IoT.
 
Sorry if I am getting off topic here, but I am very excited to feel like I am finally "cracking the nut" on some new possibilities!
 
Thanks again!
 

pete_c

Guru
Curiousity question ubergeek..
 
Yup here the HAI OpenHab version plugin 1.6 worked well with Openhab V1.5. 
 
This was a back and forth thing on the OpenHab google pages with Digital Dan.
 
Then tested the plugin version 1.7 with current release of Openhab 1.6 and it just connects and disconnects.
 
I haven't seen any testing posted messages yet relating to this version on the Openhab google message boards.
 
What version of the HAI plugin are you using with what version of Openhab are you using today?
 
It would be nice to have the serial port option on the current release of the Openhab HAI plugin.
 
Running Openhab today on a tiny build of Ubuntu 32 bit server. 
 
It runs way faster than any Wintel box I am using today (32 or 64 bit).
 
Top