austinbv/dino

Board Not Found

kd-2020 opened this issue · 122 comments

Had problems connecting to the board from Ubuntu linux:

/var/lib/gems/1.9.1/gems/dino-0.11.2/lib/dino/tx_rx/base.rb:52:in handshake': Dino::BoardNotFound (Dino::BoardNotFound) from /var/lib/gems/1.9.1/gems/dino-0.11.2/lib/dino/tx_rx/serial.rb:23:inhandshake'
from /var/lib/gems/1.9.1/gems/dino-0.11.2/lib/dino/board.rb:13:in handshake' from /var/lib/gems/1.9.1/gems/dino-0.11.2/lib/dino/board.rb:9:ininitialize'

My fix was to add:
def on_linx?; RUBY_PLATFORM.match /linux/; end

and change handshake to:
if on_windows? or on_linux?

Working for me now.

Updating your ruby may help.

Your fix simply makes the handshake wait a while before trying to talk to the board, just like I thought was necessary in Windows.

I've modified the handshake to be less aggressive in 0.12.0 and wait up to 10 seconds. It always worked fine on Mac before, but i was noticing timeouts on Windows too.

Care to test 0.12.0 on Linux and let us know your results? There are a few bug fixes in 0.12.0 that should probably be backported to patch 0.11. Would be grateful for the feedback.

Hi, iv also had a problem with dino giving me an error:
'[Error] Failed to load plugin: Arduino reason: Dino::BoardNotFound'
Im using a raspberry pi and siriproxy to run this, also im a noob when it comes to ruby and python and Linux (raspbian) iv managed to get siriproxy running with some help from elvisimpersinator and installed the plugin over on nicosuave's git but it rarely works and when it dosent I get the error above on siriproxy! I think (but may be wrong) that the proxy isn't waiting long enough for the handshake to occur, my reasoning is that the txrx lights flash briefly on my mega2560 as it gives me the error?
Anyone got any ideas that could help?
Cheers

Are you using the 0.12 branch or master?

master I believe! I noticed you saying there was a version 0.12 but I cant seem to find it? is it on your git? and how do I update my current version? sorry for the simplicity but I literally started all this about 2 weeks ago so to come from knowing nothing to vaguely understanding ruby I thought I was doing ok haha!
cheers for your help!

Im using the version included in siriproxy-arduino repo? If that helps any? Think its the master as I found the new branch on this repo, but iv got no idea how to update the repo to include the new branch from siriproxy-arduino repo? Hope that makes some sense lol

0.12.0-wip is a branch in this repo. Hasn't been released yet, so you'll need to build it from source.

First remove the version you may have installed via rubygems or as a siriproxy dependency:

gem uninstall dino

Now rebuild from the 0.12.0-wip branch:

git clone git@github.com:austinbv/dino.git
cd dino
git checkout 0.12.0-wip
gem build dino.gemspec
gem install dino-0.12.0.gem

At this point you will need to load the updated sketch for 0.12 onto your board. We've added a CLI binary to help generate the sketch files:

rbenv rehash # only if using rbenv
dino generate-sketch serial

This should crate a dino_serial folder in the working directory. Inside that is a .ino file you can open in the Arduino IDE and upload to your board. Give that a try and see if it works. I want to backport some of these changes to patch 0.11 until 0.12 is ready, so I appreciate the feedback.

Okay thankyou very much i shall try the update in the morning as its getting pretty late now and the missus is getting grumpy lol i shall update how I get on! Thanks again!

okay I get this error:
root@raspberrypi:~# git clone git@github.com:austinbv/dino.git
Cloning into 'dino'...
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

okay I managed to do it anyway by:
git clone https://github.com/austinbv/dino.git
cd dino ( it then tries to run something I just pressed 'n')
git checkout 0.12.0-wip
gem build dino.gemspec
gem install dino-0.12.0.gem

but now iv run:
dino generate-sketch serial
it generates the .ino file and I try to upload and my IDE says :

DinoSerial.cpp.o: In function `_GLOBAL__sub_D_softSerial':

DinoSerial.cpp:4: undefined reference to `operator new[](unsigned int)'

DinoLCD.cpp.o: In function `_GLOBAL__sub_I_lcd':

DinoLCD.cpp:68: undefined reference to `operator new[](unsigned int)'

collect2: error: ld returned 1 exit status

What version of the IDE are you using? The errors basically say that the constructors for the SoftwareSerial and LiquidCrystal libraries are missing, which means the libraries themselves might be missing. Open the "Sketch" menu in the IDE then go to "Import Libraries". You should see LiquidCrystal and SoftwareSerial. If not, that's the problem.

Are you compiling and uploading from the Raspberry Pi? Can you try compiling and uploading on a different machine? Once the folder with the sketch is generated you can just copy it to another machine. It doesn't matter what machine you use to compile and upload.

The important thing is that the version of dino on the computer running the Ruby code matches the version of the sketch on the board you're connecting to. I'd also recommend using the latest 1.5 version if the Arduino IDE.

ok I looked in the sketch menu and the libraries were indeed there, but no worries kuz my laptop uploaded it no problem lol!
what commands are built in? the master file responded to light on, light off but this one dosent seem to lol?
my proxy file points to dino so it should work with the plugin right?
class SiriProxy::Plugin::Arduino < SiriProxy::Plugin

def initialize(config)
#if you have custom configuration options, process them here!
board = Dino::Board.new(Dino::TxRx.new)
@led = Dino::Components::Led.new(pin:13, board: board)
@rgb_led = Dino::Components::RgbLed.new(pins: {red: 12, green: 11, blue: 10}, board: board)
end

Sounds like SiriProxy is using the wrong version of dino. Run the examples/led/led.rb example from the 0.12.0 source and see if it blinks.

On Monday, August 19, 2013 at 1:09 PM, X-Mort-X wrote:

ok I looked in the sketch menu and the libraries were indeed there, but no worries kuz my laptop uploaded it no problem lol!
what commands are built in? the master file responded to light on, light off but this one dosent seem to lol?


Reply to this email directly or view it on GitHub (#55 (comment)).

okay I get this:
Could not find gem 'rspec (>= 0) ruby' in the gems available on this machine.
Run bundle install to install missing gems.

i ran bundle install and it worked but how to i apply that to siriproxy?

Looks like the gemspec for siriproxy-arduino doesn't ask for a specific version of dino. It might be trying to fetch the rubygems version....Patching 0.11 would fix all this. Think I'll do that today.

try running gem list dino from your siriproxy project directory and see if it shows 2 versions of dino. If it does then do gem uninstall dino and just get rid of 0.11.

Btw, have you tested with the examples enough to determine if it connects reliably on 0.12?

I have tested it for about an hour with the example led file and reconnected and rebooted a couple times so so far its more reliable! Also I removed that dino as there was indeed 2 and im waiting to test it lol im not home but I can remote ssh into my pi from anywhere lol shall update as soon as I get in

Ah now it's telling me that it can't find dino 11.2 so how do I associate it with .12? Bundle install?

Think you might have to get source for the siriproxy plugin and edit the gemspec to depend on dino 0.12 or greater.

Gonna push up the patch for 0.11.3 in a few mins. It may be better to just wait on that rather than reinstalling the siriproxy gem and plugin.

On Monday, August 19, 2013 at 5:40 PM, X-Mort-X wrote:

Ah now it's telling me that it can't find dino 11.2 so how do I associate it with .12? Bundle install?


Reply to this email directly or view it on GitHub (#55 (comment)).

I would definitely rather not install siriproxy again if I can help it lol you may have to guide me through installing the patch as im certainly punching beyond my weight with all this haha

Just pushed the patch to master branch on this repo. @austinbv, can you push to rubygems? Once it's there @X-Mort-X, you should be able to get what you need working by:

gem uninstall dino - get rid of all versions and all binaries.
Go to your siriproxy project and run bundle update - this should make it start using the 0.11.3 version from rubygems.
dino generate-sketch serial - to generate a sketch compatible with 0.11.3. Upload that to the board.

well im not even sure what u mean by push lol so no id say :)

without knowing the 'push' i followed the instructions and it downloaded version 0.11.2 again...?
same happens when i install it using gem install dino?

It means that I've pushed new code up to github for the 0.11.3 patch. We need @austinbv to push it to rubygems.org now (which bundler uses), since it's his gem. He'll probably reply here when that happens.

When THAT push happens, it should start finding 0.11.3 at rubygems.org and start working.

On Monday, August 19, 2013 at 7:34 PM, X-Mort-X wrote:

without knowing the 'push' i followed the instructions and it downloaded version 0.11.2 again...?


Reply to this email directly or view it on GitHub (#55 (comment)).

ah i see! so i should be able to download it as a git still?

or do i have to wait until he has pushed it?

Waiting is the simplest thing to do.

okay will do! thankyou greatly and when its pushed i shall update you on how it goes! thankyou!

Has it been more reliable playing with the examples in 0.12?

On Monday, August 19, 2013 at 7:47 PM, X-Mort-X wrote:

okay will do! thankyou greatly and when its pushed i shall update you on how it goes! thankyou!


Reply to this email directly or view it on GitHub (#55 (comment)).

yeah definitely! hasn't played up so far! all good signs so far but i suppose the test would be for siriproxy when it gets pushed lol! is austinbv still active on here as i emailed him before posting here and haven't received a reply and that was a couple days ago lol

i suppose if anything 0.12 running the blink example, the only thing would be is that it takes 10 seconds or so to initialize properly, what i mean is it blinks slower and gradually comes up to speed but i think that may be to do with the raspberry pi... not sure but that's pretty much it so far and its not rreally a problem! had it running for a while and stop start it every now and again and no problems so far! im using an arduino mega2560 btw with a raspberry pi rev b running raspbian and siriproxy! thought id better find something to feedback for you lol

Thanks. It probably is due to the Pi. I should get me one of those.

10 seconds is a lot. The old handshake method was too hasty in raising the error. The new one waits up to 10 seconds. Sounds like you're still cutting it close.

You'll want the 0.11.3 patch anyway if using a MEGA, it fixes a dumb mistake I made where reading anything on a pin higher than number 22 would not work.

On Monday, August 19, 2013 at 8:13 PM, X-Mort-X wrote:

i suppose if anything 0.12 running the blink example, the only thing would be is that it takes 10 seconds or so to initialize properly, what i mean is it blinks slower and gradually comes up to speed but i think that may be to do with the raspberry pi... not sure but that's pretty much it so far and its not rreally a problem! had it running for a while and stop start it every now and again and no problems so far! im using an arduino mega2560 btw with a raspberry pi rev b running raspbian and siriproxy! thought id better find something to feedback for you lol


Reply to this email directly or view it on GitHub (#55 (comment)).

i could upload a video if you like? it does start blinking before that just not at the set speed more like double the speed! well i haven't really figured out what to do in terms of adding reading pins yet so that's a question i shall be asking you when i get this running lol the pi is a pretty good machine tbh! i could have made my life much easier and used the piface to do this as theres already a working plugin for that but the part where the pi fails a little bit is its not anywhere near as good at real world as the arduino so.... but amazing for tinkering with software and im sure with your knowledge youd absolutely love it! i was also considering the beaglebone black as another little thing to play with lol

id absolutely love to be able to do this like you are... i really don't understand the code or the interaction between the files and other things lol! im okay at arduino with c but that took me ages to understand the concept of libraries lol how long did it take you to learn how to do this? i mean iv been playing around with arduino for about 5 months and the pi for about 2 weeks so i suppose im not doing terrible lol

Vickash, I'm thinking about getting a udoo for use with dino / rails.
You may want to check that out. http://www.udoo.org/

On Mon, Aug 19, 2013 at 7:43 PM, X-Mort-X notifications@github.com wrote:

id absolutely love to be able to do this like you are... i really don't
understand the code or the interaction between the files and other things
lol! im okay at arduino with c but that took me ages to understand the
concept of libraries lol how long did it take you to learn how to do this?
i mean iv been playing around with arduino for about 5 months and the pi
for about 2 weeks so i suppose im not doing terrible lol


Reply to this email directly or view it on GitHubhttps://github.com//issues/55#issuecomment-22915292
.

I've heard of it. I like it. Good solution if you need to embed a full Ruby/Rails app stacked on top of dino, and need it to be mobile, like in a car. The SAM3X chip is powerful enough to do data logging work and control a decent number of things. And if you need more IO, just plug in another board.

Even with a good load from handling data from the Arduino, you'd have enough of the main CPU left over to run an entertainment system. I'm not familiar with Android at all, but getting dino working under Android and taking advantage of all the touchscreen stuff could be interesting.

Build a touchscreen app that's not just your entertainment system, but does data logging and lets you control parts of the car? All running on that single $129 board. You might be onto something there.

The Udoo is still overkill for lots of the things I want to do though. There's a tiny Chinese-market router from TP-Link, model # WR703N that runs openwrt. You can find them on ebay and google for instructions on how to navigate the Chinese firmware to flash openwrt in whatever language.

It has an onboard serial port (3.3v I think, never used it), USB (I use that), and once you install openwrt you get it to work as a WPA2 client, run ser2net (serve up a connected board that runs the serial sketch), and avrdude (upload a new version of the sketch). Both of those can be controlled via SSH, so embedding it into something isn't a bad idea at all. I've had one with an UNO connected running dino non-stop for 2 months now. Very stable and reliable.

Check that out if you're doing stuff at home or a fixed location and already have a server available to you to deploy the app on. One of those routers + a generic UNO is about 1/3 the price of the udoo. I want to do home automation, so with the amount I need, price may be more of a factor for me.

I'll write up a blog post on how to use it with dino sometime soon. If you decide to check it out, make sure you get the 703N not the 702N. It should be blue and say 3G on the side. Also save yourself a lot of confusion and connect the board through a USB 2.0 hub. Direct connection of a USB 1.1 device (the board) to the router is unreliable for some reason.

I even use a setup like this for testing while working on dino. From either my laptop or desktop, a shell script compiles the sketch with the dino CLI and uploads to the remote board using: https://github.com/vickash/avrdude-scp. I have a fixed set of components connected so this way I can keep the tests consistent from one machine to the next and don't have to worry about connecting anything or connecting different boards. Ive even got it working from inside www.nitrous.io using reverse SSH. I may write that one up at some point too.

Gotta say that the udoo does look pretty awesome! That's a quad 1.2ghz with arduino UNO wifi and touch built in? One of my pcs would cry at those specs! (Very old one sitting in the cupboard I might add) iv forgotten about the beaglebone and just found my new love lol! Is a bit steep at £70 tho! But my mega and rpi cost about that so I suppose its not too bad lol
Im not entirely sure what you said up there vickash but sounds like your saying all that could be done with a router and UNO? I was thinking that the udoo would actually find a better use in a nice laptop case with a nice touchscreen, keyboard Etc and have those pins ported out with a sata hdd and bang you have a low power laptop with arduino built in lol

It's actually an Arduino Due connected to a Linux machine with WiFi, not an UNO, so even better.

Yeah, pretty much that. Depending on your needs, one of those routers running Linux + an Arduino, or even a bare ATMega 328 chip (the heart of the Arduino) if you're willing to solder, can handle a lot of use-cases for far less. Since I'm working towards home automation, using dino more in "production" than development, and with a central server, a high number of small, cheap, lower-powered units is more appealing for that.

Don't get me wrong, I think the Udoo is great. I'll probably get one just to play with. This is the best implementation of the "Linux + Arduino + WiFi" I've seen yet. And a great deal at that price, especially the high-end one. You just have to use it for the right applications, like in-car systems. The SSD option is appealing there too. Store all your music on it and playback. Kiosks, or building interactive games would be another good use. Pinball machines maybe? Vending machines?

Btw, in case it isn't clear just how tiny this router is:
http://cdn2.sulitstatic.com/images/2012/0910/051100404_050858977d3fa58cbf59911f390d2aae369ff9ba20736b2ee.jpg

On Monday, August 19, 2013 at 10:50 PM, X-Mort-X wrote:

Gotta say that the udoo does look pretty awesome! That's a quad 1.2ghz with arduino UNO wifi and touch built in? One of my pcs would cry at those specs! (Very old one sitting in the cupboard I might add) iv forgotten about the beaglebone and just found my new love lol! Is a bit steep at £70 tho! But my mega and rpi cost about that so I suppose its not too bad lol
Im not entirely sure what you said up there vickash but sounds like your saying all that could be done with a router and UNO? I was thinking that the udoo would actually find a better use in a nice laptop case with a nice touchscreen, keyboard Etc and have those pins ported out with a sata hdd and bang you have a low power laptop with arduino built in lol


Reply to this email directly or view it on GitHub (#55 (comment)).

That router really is tiny! I am certainly intrigued how it is you make that a standalone device! It would probably suit my purposes too as im doing the home automation thing aswell but im trying to have it siri-controlled hence the need to connect to arduino! the idea was to have a arduino per room with wifi shield! This may or may not be cheaper i havnt looked to see in the uk but whats the advantage of this over a wifi shield??

X-Mort-X, I just thought I'd suggest you might want to consider something like JeeNodes or Monteino. Small, cheap, arduino clones that use radio transceivers to communicate. They seem to be particularly well suited for home automation type tasks. The $20 per board for an arduino clone + wireless communication seemed like a great alternative to me rather than an official arduino + wifi shield ($30+85=$115 per).
http://jeelabs.com/products/jeenode
http://lowpowerlab.com/moteino/
For my project I've recently switched from Arduino Uno + Raspberry Pi + Wifi Dongle to simply a pair of JeeNodes and things are going well so far.

the rpi will be kept as i need siriproxy but the clones look like a very good idea! i wasn't actually aware that the wifi shield was so much haha! that answers my question concerning vickash's idea! could use a rpi with a clone to control the other nodes? but anyway the wireless part comes much after i figure out how to control 1 arduino over serial :)! brilliant idea tho!

I apologize, we've seemed to veer off topic from the original issue. I've recently reinstalled Ubuntu to 13.04 and upgraded to ruby 2.0. I'll test the dino libraries this evening and report back to you guys.

I also wanted to bring to your attention another problem, the serial port gems seems to only be able to communicate at 9600 baud in Windows 7, I'v tried this in two different machines. The serial port gem works fine in Ubuntu.

vickash usually seems to be around about 7pm GMT onwards so im sure he will help you then :) pretty sure he wants this sorta feedback like this to help discover the bugs :)

"could use a rpi with a clone to control the other nodes?" Yep, that's the idea! You could have one node connected to a computer/rpi that collects data from, or sends commands to, up to 1.8 million standalone nodes!
http://jeelabs.org/2013/03/30/sharing-node-ids/
Well, 1.8 million might be pushing it a little. But controlling 30 nodes is reasonable.

haha i was about to say that im not going to need nor have the money for 1.8 million nodes haha! i will look into these later i think but that's pretty much what vickash is suggesting using those routers with atmega's on right?

"that's pretty much what vickash is suggesting using those routers with atmega's on right?"
I believe so. The route I have taken simply replaces the router with a radio transceiver. Both approaches have their pros and cons. As Vickash mentioned, needs/budget are determining factors.

@X-Mort-X, I'm planning to use Siri eventually as well. Leaving that part for last in case something better and less hack-ish comes along. I think it might.

As @TheBoozler mentioned, official board + wifi shield = ~$115. You can save a bit with a generic board, but generic wifi shields are still expensive. Swap the wifi shield out for one of these routers @ $20-25 and you get a few benefits:

  1. Cheaper. ~$40-$45 for dev board + router + usb hub combined, if you go generic with the board.
  2. More free program memory since you don't have to load the WiFi library. You can use the standard dino serial sketch. This is ~8kB smaller than the wifi sketch IIRC. It might not be that long before dino starts pushing up against that 30kB program limit on the 328p, so probably better to have more room available than less.
  3. Remote upload code. Not sure if the WiFi shield can, but once you have openwrt and avrdude in between, it's possible. That way you can deploy new versions of dino remotely. Hence, avrdude-scp.
  4. Security. The WiFi shield DOES use WPA2, and that's good. But having Linux in between lets you wrap (and force) the connection to the Arduino in an SSH tunnel. No RF protocol or X10 can touch that level of security.

That last benefit is important for me. I've already worked out how to control things like remote controlled gates and AC systems at a low level. You don't want those to be on insecure connections.

I looked at the jeenode as well when deciding what to buy. I think we should try to get dino running on that too btw, but again it comes down to the application. If you don't mind your lights being hackable (and realistically you might not), or need something that's quick to set up, the jeenodes are great. I'm planning a more secure, and long-term installation, so spending a bit more for security and reprogrammability is a no brainer.

I could probably use a mix of things, but standardization makes it easier to build, debug and maintain too.

By soldering things yourself, you save a lot of space. In a "production" environment, you can lose things you don't need, like pluggable headers, reset button, and the usb port. Also, both the router and Arduino can share a regulated power supply. And the USB hub is gone! There's some marginal savings here as well, but most of that I'll end up spending back on the cases.

I have to retrofit everything. This is why I want to design them to be small. Everything can't go into the walls, so much of it will have to look good and be unobtrusive. This is also the reason for wireless. If you can run cable, or are building a new place, the ethernet shield is a great option. It's even cheaper, and the main security challenge for that is physical. You'd want to run it on a separate physical LAN that only your app server is connected to and firewall it so everything has to go through the app.

@TheBoozler:
"I also wanted to bring to your attention another problem, the serial port gems seems to only be able to communicate at 9600 baud in Windows 7, I'v tried this in two different machines. The serial port gem works fine in Ubuntu."

I KNEW there was something wrong with serialport on Windows. Didn't think to try 9600 though. Thanks for that. Is it reliable at that speed? Would you mind opening a new issue for it? Not sure how we're gonna solve that one.

Well now that you got me playing with it again it isn't "reliable" at any speed! Most of the time it works at 9600. Sometimes it works fine at higher speeds, sometimes it works but has lag time, and other times it doesn't work at all. I'll play with it more, when I have time, and try to find a common denominator...

FWIW Here is the code I wrote for this testing. Maybe there is a problem with it that I am simply overlooking:
require 'serialport'

class Arduino
def initialize(baud = 9600)
@sp = SerialPort.new("COM3", baud, 8, 1, SerialPort::NONE)
sleep 3
end

def rx
@THR = Thread.new {
loop do
c = @sp.getc
if c
yield c
end
sleep 0.005
end
}
end
end

print "Initializing serialport..."
arduino = Arduino.new 57600 #<---- Change baud here for testing serialport gem
puts " Done."
puts "Now receiving..."
puts "(Press enter any time to quit. If you'r lucky...)"

arduino.rx do |c|
puts "Received: '#{c}'"
end

gets

=begin
//test sketch for this ruby script:
void setup() {
Serial.begin(57600); //<---- Change baud here for testing serialport gem
}

void loop() {
Serial.print("This is a test.");
delay(2000);
}
=end

"If you don't mind your lights being hackable"
I laughed at the thought of some neighborhood kid remotely flipping the lights on & off around the house, wife and dog running around trying to figure out if we have ghosts or something.

Both RF libraries mentioned earlier do have encryption functionality, but not to the degree of WEP, WPA. And your right, extra security precautions do need to be taken for controllers attached to things like gates, a/c, locks, etc.

I've never thought about trying to hack my garage door until now. Begs the question: If RF security can be implemented in a manner good enough for my garage door, can we implement it ourselves good enough for our needs? How secure is my garage door really? A discussion for another place I think.

@vickash iv stumbled across a few things by accident lol looking on how to change the version siriproxy looks for.... well not siriproxy but the plugin by @nicosuave..... i looked in the gemfile.lock file... and sure enough it defines dino's version number :) quick chane and save to 0.12.0 and siriproxy bundle and jobs all good! working perfectly now!

that is obviously after iv installed dino 0.12.0 and uninstalled 0.11.2 :)

just on the issue of security... couldn't i rig the rpi to only accept dns requests with certain mac addresses? and reject all others? then even if someone hacks my router they cant hack my pi and therefore cant command it? then maybe have the same sorta setup on each of those hubs so that they will only communicate with my pi or whatever...? i have probably jumped off the deep end with a question like that lol

@TheBoozler, I'm sure it's possible to do something secure enough over RF. I trust my rolling code remote to be secure enough to control the gate already. Similar schemes get used in car alarms all the time.

I seriously considered RF, but I wanted security without spending a lot of time on it. A TCP socket over SSH and WPA is a known quantity. My time is better spent working on the low level controls and the gem and eventually building a full featured app to go with it.

If you'd like to start working on a dino sketch for the jeenode, go for it. I'll help however I can. Try it without worrying about security first, it'll be easier. The sketches and TxRx in ruby already have abstractions to make it simple to switch out different protocols. You'll probably need a node connected to the computer acting as a "master"?

Wrt windows, I've done some similar tests I forgot to mention. I remember writing was working fine, but reading was a complete crapshoot. At the time it looked like the problem was in IO#select. Does anyone using this gem use Windows on a regular basis? Someone should have at least noticed this by now.

@X-Mort-X, glad you got there eventually. I didn't even think about Gemfile.lock. Was going to have you get the source for the plugin and edit the gemspec.

Also, it's probably not a good idea to have your raspi exposed to the internet. Can you describe the setup you have running now to us?

@vickash Yeah i have my raspberry pi rev B powered by wall wart, it has the arduino mega2560 connected via usb and in the other usb port is a netgear wireless dongle! i run it headless via ssh and tightvncserver from my laptop or whatever using putty and tightvncviewer! for the siriproxy i use elvisimpersonator's sd image of raspbian-siriproxy, iv downloaded austinbv's siriproxy-arduino plugin and edited the gemfile.lock as said above and your dino 0.12.0 gem branch! i can also ssh or vnc from 3g on my iphone 4s using port forwarding on my sky sagecom router! only slight issue i have with my setup is i have to change the WAN ip address if my router ever resets but that's not very often so im not too fussed!

also i already looked in the gemspec and its dependency just said 'dino' lol and i had previously tried changing that to 'dino-0.12.0' and it didn't work lol
so if i now download via git dino 0.11.3, and then change the gemfile.lock it should work right?

well i can confirm that my idea above didn't work lol so iv set it back to version 0.12.0!
im assuming that's because it isn't a branch?
If not then do all the file names etc have to be 0.11.3 because it was having problems finding it when i tried to gem install 0.11.3 and when i looked in the dino folder there were lots of files named 0.11.2 but the readme says 0.11.3......
i hope that makes sense lol

The branch was called ethernet-shield. Like this thread, it went off topic and became a whole version.

0.12 is better anyway. It's almost ready to go. I'm just refactoring some stuff.

Wrt your setup, security issues aside for now, isn't it a bit impractical to have siriproxy running on the pi?

The idea behind the router + Arduino thing is that it's no longer physically bound to the machine that has to run the ruby code, just to the router (acting as WiFi client), which converts the serial connection, via ser2net, into a TCP connection. Then I can use another more powerful machine with Linux and siriproxy, and a network connection, to connect to the router and access the Arduino.

Look at the SiriProxy initialize method. This is where it tries to connect to a board on a local serial port.

board = Dino::Board.new(Dino::TxRx.new)

As early as dino 0.11, you can change this to something like:

connection = Dino::TxRx::TCP.new("192.168.1.1") # or whatever the router IP address is
board = Dino::Board.new(connection)

Now siriproxy-arduino can be running on anything, most likely a virtual machine for me, and it connects to an Arduino over the network. If you have a server to work with, I think this is more practical. It might sound like the exact opposite at first, just adding extra things in between. But if you're interested in home automation like I am, consider this.

How will you add functionality? I've mentioned this in another issue, but let's say I build some nice looking devices to place around the house. One has an IR blaster, a temperature sensor, and also a relay hooked to a lamp.

I need to be able to switch the lamp. I also want to build a "thermostat" app to monitor the temperature and control the AC via IR. Only thing is, it's all connected to one board. Two ruby programs can't connect to the same TCP socket or the same serial port. I'd have to write two apps in one. Then if you want to get Siri to control it, you'd have to roll in siriproxy on top of that.

You have to stop thinking about it as a monolithic app. It would be a mess. I have a general idea already, but it'll take a huge amount of work. I think the final implementation is going to be distributed over several virtual machines, a large number of small "apps" that take care of different things.

At the most basic level I'll have one server that does nothing but connect to all the Arduinos, maintains the connections when necessary, and exposes the hardware on each unit via a message queue API. See #54 (comment) for more on that. That's the only "app" where the dino gem actually gets used btw.

Now that the temp sensor and IR blaster are available through API calls, I can write separate programs for them. A daemon to monitor and control the temperature which doesn't touch the relay at all. A web app that lets me turn the lamp on or off. I can write another daemon to turn the light off if it's on after a certain time. Another to turn the AC off if no one is home. Probably need some more sensors for that last one.

Maintaining a large number of these small, single-purpose apps will be far easier than a monolithic beast. Since there are so many, some of them might be required to expose their own APIs. The thermostat daemon might have an API to allow me to "set" it. Even though it's a daemon, I can now talk to it and expose the "set the thermostat" functionality via a web app, or via siriproxy (likely sandboxed into its own VM).

From this point, I can now think about building a more "monolithic" web app that controls everything, but it'll only be so in look and feel. Practically everything will be an API call.

@vickash I understand your logic, each part would have its purpose and report back to the server on how its doing! And i get why you'll be using these routers, which i think is probably the best way forward but i think, as i haven't got a clue about all this yet i should probably go simple until i get a grasp! I can always upgrade it in the future lol!
The idea i had was pretty similar to yours, id use a server (at the moment the rpi) id also have nodes, probably in the form of those routers because they are tiny and cheap and pretty much perfect, but my nodes would effectively be dumb, sitting waiting for a command before they execute!
So if i had the set up you described above my server would call on that node to tell me the temperature, the state of the light and the state of the ac, now my server would 'think' is it too hot? what time of day is it? and does it need cooling down? Sending a command depending on the results!
The only reason im trying it this way is because basically i don't know what im doing and your way will probably work much better! but this is the only way i can currently think of lol i will look into your API suggestion though!
What do you mean impractical on the rpi? It can be a tiny bit sluggish but when i overclock it im sure that wont be an issue :)

Ahh i see the purpose a bit more clearly now!
You do it this way so that you have multiple users accessing it without resetting the board!
Sorry for my dumbness but isn't that exactly what siriproxy is currently doing for me?
If i disconnect or change user, which iv done many times in the last 20 mins without thinking how many times today, my pin13 led stays on or off (however i left it) until i send a new command?

Oh and to add! siriproxy is working perfectly with 0.12.0 and has been since i updated it to look for it! Iv only had one instance where the plugin crashed and left siriproxy running, but as of yet hasn't been repeated! Think i must have been playing around with the gems at the time, so anyway its currently stable!

Those routers coupled to attiny's would be pretty awesome. I may look into
finding some of those very soon.

I rewired my whole house last year, but didn't want to do any home
automation stuff because it was way too expensive. I'm not sure what the
electrical code says about putting relays into the little blue pvc junction
boxes, I may have to look into it. I've used some insteon stuff which is
cheaper than other brands, but still too expensive for my own home. I've
built my own box for my indoor garden that has 8 controlled receptacles
using an 8 channel relay from sainsmart. Those relays are really high
quality and work flawlessly.

I'm making it electrical shock safe by using one of these
http://www.amazon.com/gp/product/B000P8COIS/ref=oh_details_o00_s00_i00?ie=UTF8&psc=1
For overload protection, I'm using these fuses
http://www.amazon.com/gp/product/B0047XWATK/ref=oh_details_o00_s00_i01?ie=UTF8&psc=1

and these fuse holders
http://www.amazon.com/gp/product/B008CVPE8C/ref=oh_details_o00_s00_i00?ie=UTF8&psc=1

I know these fuses aren't made for that kind of wiring, but I have them
there just for a tiny bit of extra protection for the relays, I'd rather
not have to buy more relays, even though they are pretty cheap.

On Wed, Aug 21, 2013 at 9:44 AM, X-Mort-X notifications@github.com wrote:

@vickash https://github.com/vickash I understand your logic, each part
would have its purpose and report back to the server on how its doing! and
i get why you'll be using these routers, which i think is probably the best
way forward but i think you failed to see the way i was considering it!
The idea i had was pretty similar to yours, id use a server (at the moment
the rpi) id also have nodes, probably in the form of those routers because
they are tiny and cheap and pretty much perfect, but my nodes would
effectively be dumb, sitting waiting for a command before they execute!
So if i had the set up you described above my server would call on that
node to tell me the temperature, the state of the light and the state of
the ac, now my server would 'think' is it too hot? what time of day is it?
and does it need cooling down? Sending a command depending on the results!
The only reason im trying it this way is because basically i don't know
what im doing and your way will probably work much better! but this is the
only way i can currently think of lol i will look into your API suggestion
though!
What do you mean impractical on the rpi? It can be a tiny bit sluggish but
when i overclock it im sure that wont be an issue :)


Reply to this email directly or view it on GitHubhttps://github.com//issues/55#issuecomment-23022173
.

X-Mort-X,

I've had an issue in the past with dino over ethernet that if I connected
and disconnected too many times too often, that it will become
unresponsive. I think that's just the ethernet shield though.

On Wed, Aug 21, 2013 at 10:38 AM, X-Mort-X notifications@github.com wrote:

Oh and to add! siriproxy is working perfectly with 0.12.0 and has been
since i updated it to look for it! Iv only had one instance where the
plugin crashed and left siriproxy running, but as of yet hasn't been
repeated! Think i must have been playing around with the gems at the time,
so anyway its currently stable!


Reply to this email directly or view it on GitHubhttps://github.com//issues/55#issuecomment-23026416
.

Well i haven't actually tried using an Ethernet shield yet or anything tbh but dino is working great for me so far! What version were you using?

Okay i take all i said above back lol!
0.12.0 does still work perfectly, but i have found that after a while of inactivity, my commands do indeed reset the arduino board..... = fail lol

@X-Mort-X, you mean after a while of not saying anything to Siri, when you eventually do, the board gets reset?

@vickash Yeah exactly that! Ill say "light on" and the arduino onboard led comes on, walk away for a bit and come back and say "light on" again, and as its being processed the rx light will blink and turn off the led just before (2-3 seconds) it turns it back on?

Sounds like siriproxy, or the plugin, is initializing a new Dino::Board instance. Care to share your code?

Yeah sure i will say though its not my code but ill add the sites here:
Siriproxy: https://github.com/plamoni/SiriProxy
Siriproxy-arduino plugin: https://github.com/nicosuave/siriproxy-arduino

The part I think that is what causes it is in the .rb file of the siriproxy-arduino plugin which ill paste here:
class SiriProxy::Plugin::Arduino < SiriProxy::Plugin

def initialize(config)
#if you have custom configuration options, process them here!
board = Dino::Board.new(Dino::TxRx.new)
@led = Dino::Components::Led.new(pin:13, board: board)
@rgb_led = Dino::Components::RgbLed.new(pins: {red: 12, green: 11, blue: 10}, board: board)
end

Vickash,

Are you in the states? #62

On Wed, Aug 21, 2013 at 4:45 PM, Vickash Mahabir
notifications@github.comwrote:

Sounds like siriproxy, or the plugin, is initializing a new Dino::Board
instance. Care to share your code?


Reply to this email directly or view it on GitHubhttps://github.com//issues/55#issuecomment-23052938
.

@X-Mort-X, Does siriproxy have some kind of built in auto-restart? This line in the plugin is what resets the board: board = Dino::Board.new(Dino::TxRx.new). Maybe siriproxy restarts itself (and the plugin) periodically, or if it crashes, or something?

@X-Mort-X , btw, yes, siriproxy is essentially filling a role similar to what my message queues will do. Except, you have to be a human and speak to siriproxy. I want an API, not just for different human users, but different pieces of software.

The message queue layer should abstract away the boards and connections, and expose APIs at the component level, for every single component on every single board in the setup. At that point it's just a houseful of components that I can write code for.

Think of it the same way siriproxy lets you say "light on" or something like that. You're not telling it what connection to use, or what type of board. You've predefined a component (light) and a method on it (on). I want the message API to do the same thing, just in a way that applications can talk to it.

Say I have 2 boards, one with the temp sensor, and one with the IR blaster. My thermostat daemon can be receiving values from a temp sensor on one board, and signaling with an IR blaster on another. It doesn't need to care about where the boards are or how to connect to them.

This sounds like it may be a completely theoretical pursuit, but imagine a scenario where a board has to be tied to one running program. If I want to monitor the temperature of every room in the house, my thermostat app would need a dedicated board with a dedicated temperature sensor in every room.

If instead, each component is exposed individually, it can just talk to whatever hardware it wants. Then I can pack the temperature sensors onto boards that carry other components to handle other functions.

PS: When using the routers my "nodes" are also essentially "dumb". There's no reason for Linux to do any processing, so technically the router is heavily underused in my application. Maybe it could be used for something in the future, but right now it's just an elaborate means of transmitting messages that could go over serial, but hey, if you need WiFi......

I will ask a man that knows much more about siriproxy than I do lol I may indeed do something like that but if I remember from a different question asked about siriproxy, it doesn't reset automatically, there is a script available but apparently siriproxy will only crash if a plugin fails so elvisimpersonator left it out with the idea that 'if it crashes the plugin needs fixing'! Makes sense to me, be like a warning that it needs sorting out lol! I may well close ports if try are unused or time out or something though! Ill ask anyway and let you know :)!
Just a question thats been bugging me, why do you think the rpi is impractical?
I see the reasons you would used the nodes and I totally agree I suppose but for my purposes i really don't mind having the dedicated sensors in place so I suppose its just a matter of opinion really lol would find it easier to debug if something goes wrong! Although im going to hold judgment until I actually understand the pros and cons of each method lol

@X-Mort-X I just installed siriproxy and hooked up an UNO. Running 0.12, the light is now on. Will wait until tomorrow to see if it turns off for itself then if not, try saying "light on" again and see what happens. My Mega 2560 is kinda tied up at the moment. Been sitting on my desk collecting temperature data for almost 2 months in the same ruby process. It's running an earlier version of the 0.12 sketch. I don't see why yours should spontaneously reconnect.

screen shot 2013-08-21 at 10 49 12 pm

Wrt the Pi, I meant it's impractical specifically as a server for a home automation deployment like the one I have in mind. At least 10 boards, message queues, multiple ruby applications, isolating things into virtual machines for maintainability. I'll need more power than a Pi.

I built a cheap quad-core home server last year, about $500. It runs 4 or 5 virtual machines 24/7. One of those VMs is even our router. Anything I do with a computer that I can figure out how to automate gets pushed onto that machine, but it still has CPU and RAM to burn. The ruby code has to run somewhere, so if I have spare resources lying around, why not?

I see the Pi as more useful if you need to embed all the processing into what you're building, just like the Udoo. Not for a distributed system like I'm trying to build. I'm not saying it can't be a server or a "node" in a similar setup, it just depends on what you need in terms of functionality and scale.

If it works well for your current uses though, then use it. If you just want to control a few things and it handles the job, then that's fine. Just build it. The hardware is cheap, and don't worry too much about wasting your time. The best thing about everything being UNIXey is that lots of what you learn on the Pi will be applicable from the tiny router all the way up to a full Ubuntu install living in a virtual machine. And everything you learn about dino will apply to pretty much anything that can run Ruby and dino.

Oh i totally agree, the pi is incredibly underpowered to deploy in a house lol!

Im simply using the pi to do exactly what it was designed for, to learn :), once i feel im ready to build a dedicated machine that's where it will be deployed just like you have done id assume.

Pretty sure i have an old laptop laying in the office that would do perfectly well running as a sever for my house, as its 1.8ghz dual core, only 4gb ddr2 ram but if they ran servers 15-20 years ago at the dawn of the internet im pretty sure that i can make use of it lol also adds the benefit of a battery backup built in and a screen for diag's!

I shouldn't think youll need to wait as long as a day.... takes about ten minutes for mine to show the behaviour mentioned!

Just out of interest what tempreatures is it measuring? Just ambient temps? Or inside a pc case maybe?

On another note, id love to be able to buy a quad core machine for $500 (£320ish) my newer i5 laptop cost just under $780 (£500) and about 3 weeks of ebay bidding trying to get a bargain lol and my i7 quad core pc cost closer to $1000 (£630) not that i use it a lot as my electricity meter goes a bit mad lol

Or.... more interestingly.... i have an old ps3 phat that's in the office waiting for a reason to be hacked as it got replaced with the sleek cheep and tacky ultraslim monstrosity i now have under my telly......

A laptop like that should be fine. Get rid of the standard OS, install ubuntu server and virtualbox, and you should have enough ram for 3 or 4 VMs. Or you could just run everything on the bare linux install if ram is an issue.

I got into the habit of doing VMs for maintenance reasons really. I like the fact that I can't screw up the host system when trying something new inside a VM. Knowing that I can get running again quickly if I need to upgrade or replace hardware on the host system is good too.

If you just want to play around for now, you can skip the VM setup if you're unfamiliar with it. If you do want to use a VM, don't worry about running raspbian in it. Debian or Ubuntu will be similar enough. raspbian is just a port of Debian for the Pi.

They're ambient temps. No idea about the ps3.

My server is an i5 3470S on an H77 board with 16GB ram. I had a case I was upgrading from already, and ram was cheaper back then, so add in a hard drive and that was the ~$500. The 3470S is a 65W cpu, but it drops down to a much lower speed when not too busy, which is where mine spends most of its time. So not too concerned about power usage. The laptop should be power efficient as well.

I may have a play around with vm's when I get a spare day or two but for now im just concentrating on learning this :)

Back on topic, did you have any joy on spotting the same behaviour as iv had?

I had a chat with elvisimpersonator, and he said siriproxy does indeed time out when not in use so im going to have to try and find some kind of workaround!

I thought about adding a line before it resets dino telling it to check state of the pins and reset with those variables?

Can't use Siri through siriproxy right now. Will let you know later when I can. Forgot to try it this morning.

Storing the state and applying it after reset will work, but it'll be slower and there's still that time period where everything resets. Maybe you can hack up siriproxy to prevent the timeout?

The message queue layer I'm proposing would make problems like this go away, since the responsibility for opening and holding the connection to the board will get moved out of sirproxy/plugin into a dedicated ruby process, so it won't matter if siriproxy, or anything else at the application layer for that matter, times out, disconnects, crashes, restarts, updates to a newer version etc.

You can do a simplified version of this message queue setup and write a new siriproxy plugin if you want. I think that's the best way to go for now. I'm writing a blog post on my current message queue setup. Should be up in a day or 2. No multiple boards, or standardized API for talking to components yet, but it'll solve this problem for you if you want to write a new siriproxy plugin.

Yeah pretty sure i can write a new plugin to solve this :)

Ill probably end up deploying your system, as you said itll solve these problems i can imagine!

What sort of time lag would we be talking about in terms of storing the state, im thinking about moving the pi and arduino to my 5ft aquarium and having it control that until i set up the server on my old lappy and figure out these api systems your suggesting :)

For VMs there's a couple of good tools. Juju and vagrant.
https://juju.ubuntu.com/ http://www.vagrantup.com/

If you work with ubuntu much, you'll really enjoy juju.

On Thu, Aug 22, 2013 at 11:59 AM, Vickash Mahabir
notifications@github.comwrote:

A laptop like that should be fine. Get rid of the standard OS, install
ubuntu server and virtualbox, and you should have enough ram for 3 or 4
VMs. Or you could just run everything on the bare linux install if ram is
an issue.

I got into the habit of doing VMs for maintenance reasons really. I like
the fact that I can't screw up the host system when trying something new
out inside a VM. Knowing that I can get running again quickly if I need to
upgrade or replace hardware on the host system is good too.

If you just want to play around for now, you can skip the VM setup if
you're unfamiliar with it. If you do want to use a VM, don't worry about
running raspbian in it. Debian or Ubuntu will be similar enough. raspbian
is just a port of Debian for the Pi.

They're ambient temps. No idea about the ps3.

My server is an i5 3470S on an H77 board with 16GB ram. I had a case I was
upgrading from already, and ram was cheaper back then, so add in a hard
drive and that was the ~$500. The 3470S is a 65W cpu, but it drops down to
a much lower speed when not too busy, which is where mine spends most of
its time. So not too concerned about power usage. The laptop should be
power efficient as well.


Reply to this email directly or view it on GitHubhttps://github.com//issues/55#issuecomment-23107399
.

Actually for that purpose the reset won't actually be a problem so no worries there really! Ill just concentrate on learning what I can from the the Api side of things!

I only actually wanted it to control ph and tempreature and have the readings spoken to me, as for the lights it won't matter if the blink off briefly, the fish wont care lol

The only time this would become a problem is when deploying it elsewhere!

@justinledwards im not versed with Linux at all if im honest!
First time iv used it is on the pi lol!
but i will definitely look when i get round to setting up my server :)
Cheers for the advice!

@X-Mort-X, just did "light on" again. It looks like the board gets reset as soon as soon as Siri connects to the siriproxy server. Doesn't even wait for the command.

@vickash It seems to happen just after siri connects, just as you start speaking! Almost as if it does it when siriproxy looks at the plugins to check the spoken work against its plugins, which makes me think that either siri dosent keep its plugins active* or there's a problem in the plugin itself?

*pretty sure it's this option

I don't hold enough knowledge about siriproxy and indeed ruby to be able to figure this one out though!

Looking like its time for me to turn my attention to those routers lol

Just looked at the Terminal window with siriproxy:

Create server for iPhone connection
start conn #<SiriProxy::Connection::Iphone:0x007fbf5b42edd0....

Plugins laoded: [#<SiriProxy::Plugin::Example:0x007fbf5b42c760 @manager=#<SiriProxy::PluginManager:0x007fbf5b42c918 @plugins=[...]>>, #<SiriProxy::Plugin::Arduino:0x007fbf5b42c530 @led=#<Dino::Components::Led:0x007fbf5b4073c0 

So this SiriProxy::Connection::Iphone object seems to be reinitializing the plugin object. This happens before any of the "SpeechPacket" messages get logged. So yeah, It's the first one you suggested.

The routers won't help this. You need to keep the Dino::Board object from reinitializing. If you use the routers and the siriproxy plugin as is, it'll still happen. It looks like SiriProxy::Connection object reinitializes all SiriProxy::Plugin objects. And the way the siriproxy-arduino plugin is designed, it initializes a Dino::Board object in its #initialize method, so in turn, the board gets reinitialized and reset.

You can either change siriproxy's behavior, or like I suggested, move the Dino::Board object into another ruby process where it won't be subject to that reinitialization, and talk to it some other way, i.e. the message queue.

@X-Mort-X

Until I finish my writeup, here's a gist for the simple setup I have running: https://gist.github.com/vickash/6313443

You'll need to have a daemon that handles connecting to the board, and then you can write a new siriproxy plugin to talk to the daemon the same way test.rb does, by just putting messages into the queue.

I've omitted the temperature reading part of the setup because I just cobbled all this together. That part was too messy and confusing, but essentially it would work in reverse. Make another queue and when the sensor receives data put it into that queue. Then another ruby process listens on that queue and does something with the sensor data, in my case logging it to TempoDB.

I shall give it a go, no doubt ill end up needing your help with it at some point lol! Ill probably end up setting up a vm on that laptop to try this as I don't want to overwrite what's currently on my pi :)

Wouldn't adding a time step into the code stop it from re running that code?

Not sure what it would be in ruby but on arduino it would use millis (as it counts from power on) then something like
If millis > 3000
Initialise.....
Else ......

No. That won't work. Since the plugin gets reinitialized as a new object, there won't be anything stored in @board unless Board#new gets called. So Board#new has to be called for a board object to even exist and get stored in @board, so it will always reset the board.

One other possible workaround would be to find some programmatic way to poke siriproxy once in a while so it doesn't timeout. Still kind of a hack, but it would work.

@X-Mort-X, what OS laptop do you have? Running dino in a VM is not practical unless you can talk to the board over TCP, either with the ethernet shield, or ser2net. If you want to continue communicating with the board over serial, you'll need to learn how to forward the serial port to the virtual machine. It's doable in virtualbox, but it can be confusing if you're just getting started with linux.

Although, if you're running a windows laptop, it's not only practical to forward the serial port to a VM, but it's apparently the only way dino works on windows if the board is physically connected to the windows machine....

If I were you I'd learn how to use ser2net first. Actually, here's the exact ser2net command I use on the 703N routers:

ser2net -C "3466:raw:0:/dev/ttyACM0:115200 NONE 1STOPBIT 8DATABITS -XONXOFF -LOCAL -RTSCTS"

This should work on the pi too. Figure out how to install ser2net on the pi, then use that line, replacing "/dev/ttyACM0" with whatever device your Arduino shows up as in linux.

Once you run that your pi will be serving up the serial connection on port 3466 (default port for dino). From ruby on windows or osx or whatever, you can now do:

connection = Dino::TxRx::TCP.new("192.168.0.149")
board = Dino::Board.new(connection)

Replace 192.168.0.149 with the ip of the pi (no need to specify the port since you used the default in ser2net). This is a different way to connect to the board but everything else in ruby works exactly as if it were serial.

@vickash
"if you're running a windows laptop, it's not only practical to forward the serial port to a VM, but it's apparently the only way dino works on windows if the board is physically connected to the windows machine"

I've been trying everything I could think of to get serialport to run reliably on windows. Wish id heard this sooner. Didnt occur to me to just fire up virtualbox, especially since I just dual boot. I wish the serialport gem were still maintained...

@vickash My preference to hard wired connections is only for testing :)

Im pretty sure all the work arounds won't work, elvisimpersonator has kindly informed me that the most likely cause of the timeout is built into siri itself lol so poking siriproxy wouldn't work if siri disconnected from the proxy basically!

All my laptops and pcs are native windows machines, some x86 some x64 some xp, vista and 7, not got a windows 8 machine yet lol!

But the one im talking about currently has no OS installed so i was thinking Ubuntu but if you think vista would be better then it can be that too!

Im at work atm but as soon as I can i shall try your instructions above!

@X-Mort-X for a direct connection id recommend going with a nix distro. Iv been having all sorts of problems with windows and the serial port gem. Ubuntu works just fine though. But for a remote connection, you can run what ever os you'd like locally because your arduino will most likely still be tethered to a nix operating system.

@X-Mort-X, start with whatever you're comfortable with as the host OS on the laptop. Ubuntu server (or some other server oriented distro) will probably consume the least resources, leaving as much as possible over for the VMs, but it's linux with no GUI.

You can start off with the full blown GUI version of ubuntu or even Windows as the host though. Later on when you're comfortable with linux, back up all the VMs, replace the host OS with ubuntu server, and just restore and restart the VMs. Easy development now, better performance later.

For the VMs I'd recommend starting with vagrant and eventually moving to virtualbox if you need more control.

Vagrant is really meant for development. It does some things, like syncing your rails app code with your host machine, that make development easier. You can find a railscasts episode on vagrant here: http://railscasts.com/episodes/292-virtual-machines-with-vagrant

I've never used juju, which @justinledwards mentioned. It looks very promising, like a hybrid between VirtualBox and something like Puppet or Chef. But this is something you'll want to use when you have more experience and it's more geared towards creating predefined configurations to deploy to multiple servers, like having a web app in production. It might be too much if just getting started.

Inside the VMs (the guest OSes) is where you can cut your teeth on ubuntu server. If anything goes wrong in there, just start over with a fresh image.

@TheBoozler, sorry. I should have mentioned that's the workaround I came up with when I was trying to help a friend with a windows laptop get started. It still wasn't 100% though. Is there a ser2net equivalent for windows?

I actually havnt used serial to ip software before. A quick google search turned up some options for windows, like hw vsp , but not free so not my style.

Personally, I dont mind just using *nix, but its frustrating to not have the option without jumping through hoops. IE in case I also want to share with friends.

@vickash I have finally given upt on the idea to use the rpi and arduino the way it stands and i shall be using your method and more than likely, the routers too lol but just out of curiosity more than anything, couldn't i write a plugin that pings apples siri server, thus keeping the connection open? Not that it matters because im sure even if it did, battery life is one of the things that will suffer with a constantly open connection!

Anyway, now onto the important stuff, iv installed ser2net on the pi but haven't attempted running it yet as i think it may have already done that itself lol.
All the guides i tend to see about ser2net say about creating a config file and adding code to the end of the file which i shall attempt at some point, just a little dubious about how far iv got and i don't want to wreck it lol!

Also, in your git readme, you state :

'Start the daemon, which doesn't actually daemonize itself....
ruby daemon.rb'

I know you said about having a daemon to handle connection to the board, which is ser2net i assume, so what do i need to deamonize that? im missing something aren't i?

It might run itself, but without a configuration line in a certain file (/etc/ser2net.conf i think), it won't actually do anything. The configuration line is the part in quotes in the line I gave you. You can start it manually with that command, and then once you're comfortable with it, just paste the part in quotes into ser2net.conf. From then it will start automatically with the settings you want. It might be easier to start it manually for now to help you debug though.

You can see what ser2net processes are running with ps | grep ser2net in case you need to kill it and restart. You shouldn't though. ser2net remains running even if you disconnect the Arduino and the device (/dev/ttyACM0 in my case) disappears from the filesystem. It just starts working again when you reconnect it. If you reboot the router (or the pi in your case), you'll need to run ser2net again unless you put the line in the conf file.

I just have a bunch of terminal windows open, tied up with the various scripts for the message queue setup since I'm still working on it. If you want to actually daemonize it, and free up the shell, use something like the daemons gem:
http://daemons.rubyforge.org/

Again, if you bring your development to a machine where you can open a bunch of shells and keep them running all the time, it might be better not to make it a daemon just yet. Easier to stop, edit and restart that way.