Connecting It All Together

Tameion

New Zealand

Hey Everyone...

I wanted to start a discussion on my goal to have a smart house with a Jarvis (Ironman) / Sarah (Eureka) like AI and my little ARC robot servants roaming around.

So feel free to jump in and contribute...


I have been using a combination of open source programs with my ARC software and EZBv3 boards. ARC is the brains of my system and provides me with the intelligent front end that responds to voice commands and communicates to my four EZB-3 boards. Lawrence, as I like to call it, replies to my voice commands using the Ivona Brian voice file. Sound very like Jarvis.

After recognising the voice command Lawrence selects what to say back to me from a pool of scripted phrases. This addresses repetitiveness in responses and adds a nice human-ish touch.

At the same time Lawrence is replying several scripts are firing commands to other applications or devices through an MQTT broker that I have installed. This Broker, from the Mosquitto open source project, acts like my AI's nervous system or neural net. I store values that are stored in the broker, similar to database that get reloaded to my various devices when they wake up.... I find this easier than an a database.

Various other devices are subscribed to the broker topics and act appropriately but you must have your own broker installed. I run mine on a separate Raspberry Pi elsewhere on my network. I keep it as a stand alone device as everything connects to it so if I need to reboot my PC it does not cause problems. It is fast, works well on the newer Pi3 and supposedly can handle 100,000 posts per second... I have only rebooted it a couple of times since installation and that was only because I wanted to move it.

So I post directly from ARC to my MQTT neural net with the EXEC command like this:

exec("C:\Program Files\mosquitto\mosquitto_pub.exe", "-h 10.1.1.120 -p 1883 -t /HOME/EZ-BUILDER/COMMAND -m Command:Lounge_Lights_On' ")

I also use a second program called EventGhost that watches for those MQTT messages and fires commands to other devices on my network that ARC can't talk to. I complete this action by triggering events in EventGhost with the same exec command in ARC:

exec("Eventghost", "-event Guest.Welcome.Video.Fullscreen")
exec("Eventghost", "-event It's_Spa_Time")

Another big player in my system is Rainmeter which adds great visuals to my screen. It lets me change the entire look and feel of the PC. While not tied directly to ARC I can launch ARC from a fancy picture on my desktop. This simple script in Rainmeter simply launches ARC when I click it. (I know I could use a shortcut but this looks way cooler)


[Rainmeter]
Author=Wayne
MiddleMouseDownAction=!DeactivateConfig
Update=86400000
MouseActionCursor=0

[Metadata]
Version=1.0
Information=Phone_Wayne TextItem
License=Creative Commons Attribution-NonCommercial-NoDerivs 3.0

[Variables]
height=60

[noimage]
Meter=Image
ImageName=#CURRENTPATH#\Tablet.jpg
W=(#Height#)
LeftMouseUpAction=["C:\Program Files (x86)\EZ-Robot Inc\EZ-Builder\EZ-Builder.exe" "C:\Users\Wayne\Dropbox\My Robotics\Launcher.EZB"  "Autostart"]

[Title]
Meter=STRING
MeterStyle=sTitle
Text=WAYNE
FontSize=9
X=10
Y=55
FontColor=255,255,133,255

And of course OpenHAB is the most recent player to come to my table. As it can communicate with the same MQTT broker I am now extending my domain out from my workshop to the rest of the house. OpenHAB is giving me a nice web front end with switches and buttons, status updates, etc. This means ARC can now turn on my lights through MQTT from a simple voice command.

So friends .... My goal of Home automation with a responsive AI and little robot servants roaming the property is slowly becoming a reality thanks to ARC.

What have you been doing?

By — Last update

ARC Pro

Upgrade to ARC Pro

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.

#1  

Just got my ez dev kit today and just started messing with it. Not used to using gui based environments for this kind of thing but thought this would be the "ez" way to get started with bots and would be good for my 7 year old also.

I used eventghost some years back but openHAB can handle anything that you would need it for with the exec binding, so it may be a good avenue for you to consolidate your software based automation.

If you don't have an amazon echo yet, you should definitely consider picking one up as the voice recognition is really superb and ties in nicely with openHAB or anything else using http or POST by using the "hue" emulation bridge. Great for lighting, tv, alarm, doors, etc. I am looking forward to checking out ez's as well for the bot control.

I too envision tying the ez bot(s) into the home "nueral" net as you say, and MQTT seems to be a leading model for connecting nodes. I'm already using to connect arduino nodes to my openHAB server for things such as relay triggers, sensor states, RGB commands for strip lighting, etc. The reading I have done on ROS seems to show this as the form of communication also between all of the nodes in the bot. I already have mosquitto running on my openhab server so I thought it would be cool if ez would ever integrate an mqtt client. But as that probably doesn't exist I plan to figure out how to use http instead.

Also, speaking of a front end for openhab, there is a pretty cool project in alpha currently that you can register for called "rotini", runs on android and is widget based and is very visually appealing, especially for cheap wall controllers.

I also have a HAI home auto panel that handles my security, fire, UPB lighting, but I leave the zwave to a vera controller, again all is integrated in openHAB too.

I'm waiting on my omnibot(s) to arrive so I can get to the teardown and rebuild but will be looking for ideas when I get to putting some projects together with ARC

PRO
United Kingdom
#2  

@Tameion, you are doing some fantastic work here! I would love to see a video of your system in operation as it sounds like it is amazing!

Tony

New Zealand
#3  

I'll work on that. It's been a couple of years have passed since I started in this direction. Others had been using MySQL as a database. I had used text files I loaded and unloaded. but I wasn't happy with either.

I solved my dilemma by using an MQTT Broker. I monitor this stream of data and use a Python script that @rich gave me to post data from EventGhost to ARC using the Terminal Port.

See Here synthiam.com/Community/Questions/5128&page=1

I also have ARC posting back to EventGhost with a single line of code. EG is of course in the system path on the PC. The command looks something like:


exec("Eventghost", "-event eventname payload1 payload2 payload3")

An actual example would be:


exec("Eventghost", "-event ARC_Terminal.Connected")

I could add the payload but don't usually bother as the event itself launches a macro. I also echo the event to my MQTT Broker feed just incase I have a device later on that may need to subscribe to this information.

So I now have a constant MQTT feed monitored by EventGhost. When it finds a relevant event it fires a message off to ARC for actioning. ARC in turn can fire events off to the MQTT stream for anyone else to action or ignore.

This way devices that don't play nicely together and refuse to talk to ARC can just post their data to the MQTT feed and EventGhost can happily watch the events until something triggers a macro that fires an update to ARC.

#4  

@Tameion thanks for the thread link! I am checking it out and looking how I can implement for my case and I will get back. I really appreciate it.

I still think your use of mqtt is more what I am looking for but Rich's python example is helpful for some other possibilities. I'm trying to figure out how to handle my mosquitto instance since I do not host it on the same machine as ARC.

Edit: Ok I installed a windows based mqtt client tool called mqtt.fx which I got connected to my mosquitto broker in about 30sec, so once I figure out how to pass the pub command to this I should be able to use your publish examples to get everything talking.

mqtt.fx does not seem to have cli available so I installed a second mosquitto install to use as a client pub/sub on the ARC pc. Working good for pub with your code

exec("C:\Program Files\mosquitto\mosquitto_pub.exe", "-h x.x.x.x -p 1883 -t /SAMPLE_TOPIC/ARC/COMMAND -m Command:Sample_Command' ")

I am wondering if ez-robot might consider an mqtt client "plugin?" for easier integration in the future. I think MQTT has become the preferred cross platform protocol in the M2M and IoT space from everything I have seen in the last couple of years. It could bring additional value to the product out of the box.

Now looking for the best way to receive commands/topics since I am not using eventghost. I am looking at setting up some openHAB rules to handle and send http commands instead.

Thanks again, I will get back with any further progress.

New Zealand
#5  

@DJSures

I know that you get hundreds of requests for additions to ARC but would you consider having another think about adding an MQTT client to ARC?

#6  

@Tameion thanks for putting this forward to @DJ, this truly would be an excellent method for "connecting it all together". I can imagine that they are flooded with feature requests all the time, but I can see this one also making sense for their target demographic since mqtt can be easily handled in the educational space with a simple subscribe/publish of easy to understand "topics" and the ability to connect one project to another.

#7  
#8  

Alan, you bring up a great point. I think all kinds of great mods come from active community development, I hope to find alot of cool plugins once I get going here...

In this instance I suppose I was looking at MQTT support as a request to support an actual protocol, just like HTTP, etc. I thought that protocols tend to be implemented and maintained with the product to ensure continued and reliable functionality through the product life cycle.

In IoT and node to node communication, II think MQTT is tending to be the preferred protocol now due to its simplicity and lightweight, that's why I thought it would be great in general for the product, not just very specific users.

I am not a C# programmer either and most of my scripting has been linux based but maybe I could try to see what's involved (very limited JS, C, python), although I am not sure I am capable. I think most users here are initially attracted to the user friendly approach to get started in robotics here...I really wanted to jump into ROS but after reading much of the wiki I can see a "bit" of a curve, hence EZ-robot.

What is cool is that MQTT could also tie in (I believe) future ROS nodes to the EZ-robot universe, supporting additional progressions in learning and education, but I could be wrong here ...

Anyway thanks for the suggestion, maybe someone else here in the community might jump in if it is of interest and value to them to write a plugin, it would certainly be awesome in my case to "connect it all together"!

#9  

I agree that built in has advantages, but this is exactly the kind of function that the plugin architecture is perfect for. Populating variables from external sources, and sending variables or commands from scripts. DJ's todo list, and bug fix list is very long, and he is the only one doing primary programming on ARC at the same time he is trying to run and expand the company from a few friends in a garage to a real business in the STEM space.

If it peaks his interest, he'll add it ahead of other things on the list, and I have often seen conversations like this drive new features (usually just as I figure out a workaround, he adds a feature....), but I know he is really trying to encourage the user community to learn to program and write plugins where they are a good fit.

I am hoping this fall/winter (once it is too cold to mountain bike on the weekends) to sit down with Visual Studio and get back up to speed on programming. I used to be pretty good with VB6, but I have not been able to wrap my head around dotnet yet, and I also want to learn Java for some work related stuff. I have a lot of plugin ideas I want to create, and this one looks like it would be a snap to complete since the APIs are already in place and well documented.

Alan

New Zealand
#10  

I hear what you are sayinig Alan... many a time I have suggested a tweek to ARC, completed a work-around and had @DJSures come up with just the right solution. Then I have gone back and recoded with the updated commands.

As for the plugin idea I have made a new friend who has way more skills in the field and we'll have a look on Thursday New Zealand time.... no promises though. I feel like a small fish with big ideas surrounded by many bigger fish.

Would be great to have my name beside a plugin. I've been around since almost the beginning ... and it would be great to give back to the community.

@Tameion

New Zealand
#11  

Okay friends it is time for an update.

We have started development on an MQTT plugin for ARC.

Initial tests have been successful but it is still very early days so don't jump up and down too much. Not even at v1.0 yet ... more like a 0.1 actually...

Anyway it would help me to know if anyone else out there is interested in using such a plugin.

  • Tameion
#12  

@Tameion , this sounds like a very useful thing to have in the ARC toolbox. I'm sure it will get a lot of attention over time. Personally I don't have a use for it yet (I think) but projects I'm planning could use this. Bring it on! ;)

New Zealand
#13  

Thanks Dave... I think it will be useful. I see MQTT used to 'connect' more and more devices, in a lot more and more places every time I look... mind you I am actively looking.

I particuarly like the possibility of using it to hold variables in topics for pickup by my various ARC installs and my other apps/devices.

#14  

I am very interested in this plugin. I use IBM MQ at work, and it is very powerful for sharing data among distributed applications. I could certainly see this as a great way to have multiple robots share global variables as well as easy integration to other devices.

Alan

New Zealand
#15  

Our minds connect and have begun sharing data among distributed locations. (Lol - sounds hippie-ish but I'm not really!)

I have been sharing variables between PC's running ARC for a number of years. Ever since @DJSures gave us file read/write functions. (Yes I have been around that long!)

I have 5 different PC's running ARC and since they are not all on the same LAN I share data via a TXT file in Drop-Box that they load at startup and write to at various times. While I get the occasional file conflict and associated versioning issues it has been an effective, if not clumsy, means of passing variable information between the installations. Especially since the units are not always going at the same time or on the same LAN.

Sooooo .... my goal with MQTT is to use the RETAIN message ability of the MQTT broker to hold my variables and act as an information database as well as. If there is a power fail then they are reloaded of course but they can also be updated on the fly.

This is especially valuable if the Workshop AI (Lawrence) wants to pass info to the House AI (Viki) and share it with Bert the Bot who occasionally drop off the network or crashes and loses power. I can also share this data with the ARC install at school and any other IoT device on my network . Well that's the plan anyway.

I'm a bit of a home automation geek and I know I could do this with HTTP Put & Get or a MySQL database but the ability to constantly monitor a topic in the broker until it changes is mind blowing in terms of what I want to do.

This project will allow me to say to my ARC installs "Turn on the lights" with the voice command, ARC will work out where the command came from and will post "Lights ON" to the MQTT Topic for lights in that particular room.

OpenHab, a popular home automation platform which also uses MQTT will "See" the topic for lights in that particular room have been turned on and the update the status of the Web interfaces Screens around the house at the same time as the IoT light switch, also watching that particular topic, turns on

OpenHab, EventGhost and ARC are all talking to each other and are best buddies.

#16  

A few years ago DJ added push and pull variable commands with the intention of storing them on EZ-Cloud. I don't know what ever happened to that project, but it never happened. Your file sharing and Daves EZ-DB project were good workarounds, but I really like this mqqt idea a lot.

Alan

PRO
USA
#17  

@Tamieon, you ok? Heard NZ had a powerful quake.

PRO
USA
#19  

That's insane! The fault line divides the country. Upthrust explains those majestic mountains. I have friends that work at WETA, they are all ok too a bit shook up.

I was two miles from he epicenter of the 94 Northridge quake in Los Angeles. It shook my house apart and that was a 6.8!

New Zealand
#20  

@fxrtst it took me a min or two to work out your username... very good! So do you Cosplay as well?

PRO
USA
#21  

No, I work in the film industry doing make up effects. Goto IMDb.com and look up my name Will Huff.

Also goto see my robot Alan at: www.getaheadinrobotics.com

#22  

@Tameion I'm very glad to hear you are pursuing the mqtt plugin...will be very interested to integrate with my openhab instance at home!

New Zealand
#23  

Would you mind sharing a little about your OpenHab project? It might help with development at this end.

#24  

I have openHAB tied into the following systems :

  1. Omnilink Binding - for HAI automation panel - Security/UPB lighting/Zwave lock support/Relays for garage doors (some basic programs on this, but more complex rules running on openHAB).
  2. Ecobee Binding - Ecobee thermostats
  3. Amazon Echo voice control (command only via "echobridge" docker (http) for items/rules) states update in OH
  4. Logitech Harmony Hub Binding for A/V control
  5. Logitech Squeezebox Binding for multi-room audio
  6. MIOS Binding - two-way communication with Vera for other Z-wave, etc.
  7. MQTT Binding - two-way communication with multiple arduino nodes for sensor readings, LED RGB strip lighting control, relay activation, etc.
  8. emoncms - energy monitoring getting updated sensor readings passed through openHAB from Vera
  9. Network monitoring for server(s) status
  10. Camera streams in app
  11. IFTTT integration through myopenhab ("Automatic" vehicle diagnostic and location)
  12. Project "Rotini" for android based cheap wall panels
  13. Weather Binding - for forecast and current conditions

Thats an overview of the implementation I have, but with an MQTT plugin for ez-robot I could see where any openHAB event or item setup with a topic could be used for integration of the "bot" for controls or feedback.

I haven't really thought too much yet about the things I would like to achieve as I am still trying to get my first ez-robot (omnibot) completed. I have most things working (RGB led eyes, 2x16 lcd screen, CV, ultrasonic sensor, H-bridge motor drive) except for servo arms yet to do. But with full two-way communication with openhab more easily possible with MQTT I can see that there would be alot of possibilities that could be achieved relatively easily.

#25  

Was wondering if you guys might be kind enough to answer a question about your MQTT Broker setup. In your code your have:



exec("C:\Program Files\mosquitto\mosquitto_pub.exe", "-h 10.1.1.120 -p 1883 -t /HOME/ARC/COMMAND -m Command:Lounge_Lights_On' ")


Could you please explain the :

/HOME/ARC/COMMAND

part?

Thanks in advance.

New Zealand
#26  

The command posts a message to your MQTT broker on TOPIC /HOME/ARC/COMMAND

This has within it a payload of Lounge_Lights_On

If you are monitoring your Broker and subscribed to the topic above you should see a message to this effect appear in the stream of data.

Use an APP something like MQTTLens to monitor your broker. www.hivemq.com/blog/seven-best-mqtt-client-tools

We have a plugin in beta at the moment and it loads a single variable with the payload of whatever topic you are subscribed to ...

Project is on go slow as a key member is overseas for another month but we will get back to it soon....

#27  

Thanks for your reply. I have setup Home Assistant www.Home-Assistant.io and have one switch working, now looking to see how to tie it into EZB. Would like to have at least one working example here before diving in head first. It looks simple enough from your example but as I have found out, looks can be deceiving ... lol. Later today when time permits we'll give it a run and see what happens.

Thanks again for your assistants.

#28  

Hello Again ... lol

My MQTT Broker is running from a Raspberry Pi. The script example above runs from a MQTT broker on the PC. I could not for the life of me figure out how to get it to run from the Pi.

Headaches, hair pulling and yelling at the computer brings me here again! Was curious, if either of you guys here with MQTT on your Windows PC had any trouble installing it? I have spent the better part of two days trying on three different PC to get up and running! I have Googled & Googled read EVERYTHING on the net (lol) still no luck. I am aware of the .dll's that need to be in place, Visual Studio Redist., still no go. So, did it go smooth for you guys?

New Zealand
#29  

Yes the code example above in post #26 is for the PC. It was a one liner in an ARC script that sends messages directly to your broker and of course needs to have ARC and Broker on the same PC for this to work.

I did have some trouble installing on a Windows PC.

Had to fiddle with the firewall. Worked well on 127.0.0.1 but Windows security caused me grief.

So I stayed with the Raspberry Pi Broker. I need the broker to be in an "always ON" state and stable. I seldom have to restart it unlike my PC !

#30  

Finally got the PC mqtt broker up and running last night. I was getting a error on .dll files. Decided to try another openssl version and that did the trick. Now getting ready here to give the example code above a go.

You say you stayed with the Raspberry Pi broker. (I don't think you can beat a Pi, as it seems really stable and cheap to run.) I assume that you are bridging the pc broker to the Pi broker?

If so, did you run into any trouble doing it?

#31  

I'm back:) New problem:(


exec("C:\Program Files\mosquitto\mosquitto_pub.exe", "-h x.x.x.x -p 1883 -t /SAMPLE_TOPIC/ARC/COMMAND -m Command:Sample_Command' ")

I am running into an EZB error. Yours: "C:\Program Files\mosquitto\mosquitto_pub.exe" Mine: "C:\Program Files (x86)\mosquitto\mosquitto_pub.exe" When I put the (x86) into EZB code I receive ... error line 1 Missing ) in expression. Taking the (x86) out of the code I receive ... error can not find file, or something like that.

Any ideas?

Maybe DJ will read this too and give a idea what to do.

#32  

you are missing an opening quote in the path (at least from what you copied and pasted. Better to copy and paste the entire line, rather than an excerpt for proper troubleshooting.

Alan

#33  

In my script I do have the quote. When I copied and pasted it, the quote was missed, now corrected. Your right, it is better to copy the whole script line. I just wanted for people to see the comparison side by side.

Thanks for looking at it Alan.

#34  

So, this may be something DJ needs to fix, or you may need to install mosquitto to an alternate directory than the default.

On 32 bit windows systems, everything gets installed in \program files.

On 64 bit Windows. 32 bit programs get installed in \program files (x86) and 64 bit programs get installed in \program files.

The issue is that parenthesis mean something in EZ-B script language, and unlike some scripting languages, there is not a "escape" character to tell the script to ignore the following parenthesis.

Quickest fix would be to re-install mosquitto, and during the install, choose a custom install path - either c:\mosquitto or put it in c:\program files instead of c:\program files(x86)

Long term, this is something DJ will need to fix I think.

Alan

PRO
USA
#35  

@Alan, @Fob

If the problem is the " ) " you can replace program files (x86) with the equivalent short name.

check the thread (post #11): https://synthiam.com/Community/Questions/9006&page=2

something like this:


exec("c:\progra~2\mosquitto\mosquitto_pub.exe", "-h x.x.x.x -p 1883 -t /SAMPLE_TOPIC/ARC/COMMAND -m Command:Sample_Command' ")

#36  

I forgot all about short names. Excellent solution!

Alan

#37  

Thanks for the reply and the link:) Will give it a shot when returning home. I must have had a brain fart or something not trying the install it into another path after the code did not work:( Never new the way the link shows? Glad we have this forum and people to help and share.

#38  

MQTT broker is up and running, code from EZB to broker is now working ... it's a Christmas Miracle! Now on to the next step, isn't there always a next step? Would like to thank all for the help! I really do appreciate it.

#39  

@Fob You know you could really show your appreciation by giving back to the forum... How about a video on what you are exactly doing?... Maybe others (I know I am curious) want to see what this is all about...

#40  

Yes! Please share with a video and pics! We love that stuff!

Feel free to build a project page documenting your process with discussion, pics and video. others can follow, add their ideas, help with problems and learn from you. :)

#41  

Your right Richard R. My daughter has a video camera, I'll see if I can borrow it. My phone is too cheap to do one with. I am just starting in this direction, MQTT broker and home automation, as you can see but it might get others interested knowing what it can do. We all want our bots to do as much as it can. EZB is a great platform for this also.