View unanswered posts | View active topics It is currently Thu Apr 17, 2014 6:29 am



Reply to topic  [ 29 posts ]  Go to page: 1, 2  Next
 Indigo and Arduino 
Author Message

Joined: Mar 14, 2010
Posts: 2
Post Indigo and Arduino
Hi. I'm planning a new-home lighting control system and I'd like a little feedback on my high-level design. Then I can start asking more specific questions ;)

I'm planning on controlling SSRs using one or more Arduino boards. The Arduinos would also monitor switch states. The Arduino connects via USB so I *think* that rules out using Serial Bridge. I was able to get Indigo to trigger an Applescript that sent a message to the Arduino and cause an LED to turn on or off. What I haven't figured out is how to listen to the USB port. I understand an Applescript could do that in theory, and then pass that info on to Indigo. But I haven't figured out how to do that in an Applescript. I started looking at XCode projects but I don't know the studio well enough to figure out how to modify the code for my use.

Can anyone comment on my overall plan and offer any critiques or suggestions? FTR, I'm not interested in using X-10 or Insteon.

Thanks,
Mike


Sun Mar 14, 2010 9:10 pm
Profile
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 8350
Location: Austin, Texas
Post Re: Indigo and Arduino
If you're comfortable using another scripting language then you could use one of those to do the comm with the Arduino and then use the RESTful APIs to update information in Indigo. I found this article about dealing with it via python for instance.

Having said that, since the Arduino hardware uses the FTDI driver, which creates a virtual comm (serial) port, you should be able to use Serial Bridge if you really want to. I wouldn't really recommend it since SB is pretty much in legacy mode and isn't likely to get updated.

_________________
Jay (Indigo Support)
Image


Sun Mar 14, 2010 10:17 pm
Profile WWW

Joined: Mar 14, 2010
Posts: 2
Post Re: Indigo and Arduino
Jay,

Python sounds way easier. I thought I was limited to Applescript for talking to Indigo. The RESTful API stuff looks interesting. I hadn't heard of that before. Is it simply a matter of having Python (or some other language) send that info to the given URL? And defining the URL is part of the Indigo setup I suppose? That would simplify things. Where can I find some documentation on the RESTful APIs?

Mike


Mon Mar 15, 2010 7:58 am
Profile
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 8350
Location: Austin, Texas
Post Re: Indigo and Arduino
The link above is to the docs on the RESTful APIs. They are very straight-forward so don't really need any more information. And yes, they work from any environment that can do HTTP GETs or POSTs.

_________________
Jay (Indigo Support)
Image


Mon Mar 15, 2010 8:10 am
Profile WWW

Joined: May 22, 2010
Posts: 3
Post Re: Indigo and Arduino
I am trying to use the RESTful URL (http://127.0.0.1:8176/devices/), but I get a "can't connect to the server" error.
I checked the IP address, but do I need to modify the port number?
Server is 4.1.7

Thanks


Sat May 22, 2010 7:34 am
Profile

Joined: May 27, 2007
Posts: 694
Location: NC
Post Re: Indigo and Arduino
The 127... Is a loopback ip. Have you tried the ip of the server itself?
(loop back should be ok -if- you are running the server and this app on the same machine. But try the real LAN ip and see what happens)

though Ive never used the restful api so the lopback may be the norm. Sorry if I'm off base


Sat May 22, 2010 6:22 pm
Profile

Joined: May 22, 2010
Posts: 3
Post Re: Indigo and Arduino
Thanks anode.
I did try with the actual IP address of the server.
I found that the problem was with the port. The example 8176 was not working.
I looked at the server preference and found that it was setup to use 8000. After changing the RESTful URL to 8000, it now works!


Sat May 22, 2010 9:12 pm
Profile

Joined: May 27, 2007
Posts: 694
Location: NC
Post Re: Indigo and Arduino
Just curious, working with real ip or loopback?


Sun May 23, 2010 4:54 am
Profile

Joined: May 22, 2010
Posts: 3
Post Re: Indigo and Arduino
real IP.
I have not tried loopback.


Mon May 24, 2010 10:14 am
Profile

Joined: Nov 26, 2009
Posts: 1340
Location: Kalispell, MT
Post Re: Indigo and Arduino
Might someone have some sample AS code to send an Arduino commands?
I'm setting up Arduino sketches to control an LED strip.

Thanks,

Carl


Thu Oct 13, 2011 12:21 pm
Profile

Joined: Nov 26, 2009
Posts: 1340
Location: Kalispell, MT
Post Re: Indigo and Arduino
Thinking of setting up some Christmas lights using a LPD98806 LED strip controlled by an Arduino from Indigo.

I had it working about a year ago, with a ton of help from berkinet, to control it from Indigo on a remote
machine but now the Arduino is setup on my Indigo machine.

I just need to send it simple characters, "a", "b" etc. and was thinking maybe a plugin could do that?

It's at /dev/cu.usbmodem21 according to the Arduino app.

Any ideas?

Thanks,

Carl


Fri Nov 23, 2012 12:25 pm
Profile

Joined: Nov 26, 2009
Posts: 1340
Location: Kalispell, MT
Post Re: Indigo and Arduino
Can Python send serial commands?

Trying to piece together something like this to send a "b" to the Arduino:

import serial
s = serial.Serial(port='/dev/tty.usbmodemfd541', baudrate=9600)

s.write('b')

Edit: In the Arduino sketch a "b" command should make its LED blink on and off twice.
What's happening when I send the above code from Indigo is making it blink
a few times very quickly. I tested the sketch from the Arduino serial monitor
and it works fine from there. Any ideas?

Thanks,

Carl


Fri Nov 23, 2012 11:00 pm
Profile

Joined: Nov 26, 2009
Posts: 1340
Location: Kalispell, MT
Post Re: Indigo and Arduino
Doh, again. Got it.

Seems all it needed was to replace the:

s = serial.Serial(port='/dev/tty.usbmodemfd541', baudrate=9600)

s.write('b')

with:

text = serial.Serial(port='/dev/tty.usbmodemfd541', baudrate=9600)

text.write('b')

Carl


Sat Nov 24, 2012 1:07 am
Profile

Joined: Nov 26, 2009
Posts: 1340
Location: Kalispell, MT
Post Re: Indigo and Arduino
Just a general question but can anyone think of a reason why when executing
the above python script from Indigo it only works if the Arduino app and it's serial monitor
window are opened?

Thanks,

Carl


Sat Nov 24, 2012 6:45 pm
Profile
User avatar

Joined: Nov 18, 2008
Posts: 2251
Location: Berkeley, CA, USA
Post Re: Indigo and Arduino
I don't know a lot about the arduino, but, I suspect that something needs to create the serial device. That is, just plugging the arduino into the Mac may not automatically establish the device. I suggest you kill the arduino app and the following in a terminal window:
cd /dev
ls tty.usb*

Then, start the arduino app and do the ls tty.usb* command again.

See anything different?


Sat Nov 24, 2012 8:35 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 29 posts ]  Go to page: 1, 2  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.