Closed kd-2020 closed 6 years ago
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)
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 (https://github.com/austinbv/dino/issues/55#issuecomment-22887677).
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 (https://github.com/austinbv/dino/issues/55#issuecomment-22906655).
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 (https://github.com/austinbv/dino/issues/55#issuecomment-22912635).
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 (https://github.com/austinbv/dino/issues/55#issuecomment-22913190).
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 (https://github.com/austinbv/dino/issues/55#issuecomment-22914188).
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/austinbv/dino/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 (https://github.com/austinbv/dino/issues/55#issuecomment-22919326).
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.
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:in
handshake' from /var/lib/gems/1.9.1/gems/dino-0.11.2/lib/dino/board.rb:13:inhandshake' from /var/lib/gems/1.9.1/gems/dino-0.11.2/lib/dino/board.rb:9:in
initialize'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.