This forum is a read-only archive. Posting, accounts and search are no longer available.
1 / 72
Sep 2015

Hi,

I’d like to install Open Hybrid on the raspberry Pi (as an Hybrid Object).

I understand that it’s not implemented yet for raspberry, I can try to do it.
==> If you had to do it, how would you start? What would be the main steps?

Can you confirm that software is realease under the “Mozilla Public License, version 2.0” license ?

Thanks!

Nico

Frequent Posters

Hi,

My current understanding,

The object “brain” is a node.js app. So the first steps are:

  • Done: install node.js on the raspberry pi
  • Done : delete the hardware interface for arduinoYun from object/hardwareInterfaces
  • Done : execute the node.js “object” app
  • Todo : test if it can connect to the IOS app and add markers
  • Todo : write a new hardwareInterfaces based on emptyExample and arduinoYun for Raspberry
  • Maybe: write an “HybridObject” for raspberry?

Misc:

  • The editor is the IOS part and shouldn’t need any changes

@valentin : Am I on the right path? Any advices?

Thanks!

You do not need to remove the ArduinoYun from object/hardwareInterfaces. You can define many hardware interfaces that are searched for at the same time.

Your first TODO should work out of the box.
Your second TODO might be more complicated and we could keep up a conversation about the APIs.

I think my advice would be that you study the arduinoYun hardware interface and come up with ideas how it could be easy adopted for the RasPi

28 days later

The raspberry pi does not have an inbuilt WiFi like the arduino Yun , so how do we resolve that when using a USB wifi adapter on the pi ?
@valentin

You will need to run linux on the Pi. Within linux you will need to install the node.js compiler. This allows you to run the open hybrid server.

Since you run Linux, the networking hardware is taken care by the operation system.
It does not matter if there is ethernet or a wifi dongle.
If the PI has a network connection, the open hybrid server will work.

will the default raspebian OS for the pi be sufficient or should i install any specific version of linux?

hi
i went through the hardware interfaces code, my doubt is that is it possible to use the same code for the pi by redefining the code for connection alone

Your doubt can be answered by typing “node js raspberry pi gpio” in to google.

An update:

Done: I’m able to connect to the IOS app almost out of the box as you said. I still removed the arduinoYun interface because it needs librairies that didn’t work on first try on the raspberry.

Todo: document how to install node.js and the required librairies on raspberry: I have a hard time making all dependencies working well on raspberry: it has to work on the right ARM version. I’ll post all the steps to install node.js and its dependencies when i’m able to make it all works.
Todo: Install a debugger: I understand the main steps of the workflow. It’s difficult to understand the details without a debugger, i’m trying to install one but it add more dependencies to make it work.

To sum up, it should go faster when I’m done with the install/compatibility issues.

@V_Mohammed_Ibrahim : using it on raspberry requires to rewrite some interfaces, that’s what i’m trying to do. Would you like to help?

@Nhibot yes i would definitely like to help , i have a team here and we are also trying to build it for the pi,we are also just begning

If you go to the folder with the server.js code you just have to type npm install. This should make sure all dependency get installed.

For debugging you just need flip the debug variable in the server.js code to true.
You can use the console.log() as debugging output.

I did “npm install”, it tries to install all dependencies, but some fails :o/

I didn’t see the debug variable, I’ll try, thanks.

2 months later

Hi, the dependencies for the Hybrid Object won’t install.
I’m getting this error

/usr/local/bin/node: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version GLIBCXX_3.4.20' not found (required by /usr/local/bin/node) /usr/local/bin/node: /lib/arm-linux-gnueabihf/libc.so.6: versionGLIBC_2.16’ not found (required by /usr/local/bin/node)

Yes, I’m following the installation guide.
My OS is Debian 7.8 ‘wheezy’

@professorminh I have confirmed that OpenHybrid will run on Raspbian GNU/Linux 8.0 (jessie), I have not tried an earlier OS version. It may run on 7.8, though. Before upgrading, could you try the following steps and let us know if they work well for you?

  1. Update the system software.

    sudo apt-get update
    sudo apt-get upgrade -y
    
  2. Remove the default nodejs instance and replace it with v0.12 or higher (more details on nodesource 3 github)

    sudo apt-get remove nodejs
    curl -sL https://deb.nodesource.com/setup_0.12 | sudo -E bash -
    sudo apt-get install -y nodejs
    
  3. Get the latest OpenHybrid Object code and download dependencies

    git clone https://github.com/openhybrid/object.git
    cd object
    npm install
    
  4. Run the OpenHybrid Object code

    node server.js
    

A this point, you should be able to navigate to port 8080 on your device and find the Object dashboard.

It couldn’t install on Debian 7.8 so I updated to Jessie.

Now there is a new problem installing the object dependencies. I’m getting, “fragmentation fault”

I’m about to give up on this on the pi

Hi @professorminh , are there any other details you can can provide?

Which version of the Pi are you using?
Are you using the Raspian Jessie image installed via NOOBS? (https://www.raspberrypi.org/downloads/)
At which step did you run into this error?
What exactly is the error message?

Nodejs on the Pi is fairly common, so I’m certain we can work through any issues you are running into, as long as the hardware is supported.

I upgraded to JESSIE via NOOBS.
I’m getting ‘fragmentation fault’ at ‘npm install’

oh well. It wasn’t meant to be. I’ll install this on my laptop.

@professorminh the server will run on the laptop just the same as the pi , until the GPIO interface for the pi is ready , it is the same weather you run it on pi or laptop , would you like to help us build the pi interface for GPIO? :smile:

I’m more of an Arduino guy :slight_smile: although I’m pretty good with JS.
I’ve created something similar to open hybrid on the Arduino platform but the interface is web based and the ‘objects’ are all in memory so no coding for the users. The objects are generic device objects where the user can instantiate and adjust its parameters. There are pros and cons to this.

Maybe there can be a “hardware interface” that talks back and forth with your own platform? :sunny:

Yes, you can link hardware together. The arduino is the server and is the middle man to interpret signals from the linked hardware. It’s usually true/false flags to whatever parameter like the temperature is higher than 80F, flags a true. The lights look that the temperature sensor for a true signal to turn off. All devices are connected to the Arduino server. It’s all through an html form setting and the values are saved to the ‘Object’. I’m not familiar with Open Hybrid but I assume it works similarly.

@valentin

we should put this info on the pi install test page ,these are the specification of the pi while testing the install manual

Pi model : B+ v 1.2
OS : Raspbian Wheezy
node : v 0.12.6

@KevinOrtman is this setup more up to date and matching with the present guide on the webpage?

Pi 2 Model B v1.1
OS: Raspbian GNU/Linux 8.0 (jessie)
node: v0.12.9

Yes, @valentin and the install should work for both.

@V_Mohammed_Ibrahim would you be able to run though the steps with your Pi? That would allow us to claim support for both Pi 1 B+ v1.2 and Pi 2 B v1.1 (though I don’t think the steps would cause any issues on the older hardware, it’s good to check).

I’m on Adafruit’s watchlist for a ZERO, once I get my hands on that, I’ll test similar.

I’m running pi B and won’t install. So it looks like it’ll work for the newer pi.

@KevinOrtman i followed the steps , everything was fine until " npm install" it returns illegal instruction
dont know weather this is because i installed the OS by writing it to sd card using the win32diskimager , will try using NOOBS and test again

I’m trying to get it running with raspbian jessie on a PI B+ v1.2. So far no luck, everything installs just fine, but when I try to run node or npm I run into a segmentation fault. I will continue to look into it and let you know if I succeed.

That stinks. Do you get a response when you run ‘nodejs --version’ ?

booo. Maybe the nodesource.com build is using Pi 2 specific HW flags.

Could you guys try uninstalling the current nodejs and install adafriut’s distro?

curl -sLS https://apt.adafruit.com/add | sudo bash

I will do the same.

OK, that seems to work, it installs node v0.12.6 and npm v2.11.2. What I did (caution: the nodejs package is called node in the adafruit repos and not nodejs):

curl -sLS https://apt.adafruit.com/add | sudo bash
sudo apt-get install node

Currently I’m running npm install. It’s taking forever…

UPDATE
Ok works perfectly. HybridObject server is up and running.

yes , i think i should also use node instead of nodejs , i had used node last time , that may solve the problem ,will let you guys know :smile:

Ah, ok, but when you install from nodesource you have to use nodejs because that’s what they call their package, I think… But you could try to install the adafruit node, as well. You are running Wheezy right? If that works, we could change the manual to use adafruit instead of nodesource and add Wheezy and Jessie to the supported OSes list. Hopefully it will even work on the PI 2, which is what Kevin is figuring out right now.

Installed on pi B+, works good!
steps I followed:

  1. sudo apt-get update
  2. sudo apt-get upgrade -y
  3. curl -sLS https://apt.adafruit.com/add 4 | sudo bash
  4. sudo apt-get install node
  5. node -v
  6. git clone https://github.com/openhybrid/object.git
  7. cd object
  8. sudo npm --unsafe-perm install
  9. node server.js

note:
sudo npm --unsafe-perm install will take care of all the permission issues

gyp WARN EACCES user “root” does not have permission to access the dev dir “/root/.node-gyp/0.12.6”

Yes that’s what I did too. Except for the - - unsafe-perm that wasn’t necessary for me.

You guys are great! I ran the script above on my out-of-the-box Pi 2, and it worked without complaint.

Then I picked my way through some of the tutorials for Arduino, and after a few gyrations got a test Vuforia object built and apparently somewhat loaded. I loaded Reality Editor on my iPhone, and pointed it at my target. I haven’t added any object code to the Pi, so I’m not sure what it should do, but after pressing the icons at the top I get a dev’p page that shows my Pi’s IP address under “Found Objects”. No highlights or anything on the screen, though…I assume because I’ve added nothing.

So, now I’m a bit confused. Can I ignore some of the Arduino-ish parts and go straight to the Adding Web Content part? Should I already see something as an overlay?

Tomorrow, I’ll plink around with adding files to the Add Interface and see what happens with some trial and error. But if somebody has advice that’d be appreciated too!

Thanks for the confirmation, @AndrewsJustin, that’s awesome!

The reason you needed the ‘–unsafe-perm’ flag is because you ran npm install as root. If you remove your node_modules directory and try again without sudo, you should not run into the EACCES warnings.

Also you may want to check dpkg --get-selections | grep node to see if you have two packages installed (node and nodejs - nodejs typically comes pre-installed on Raspian). sudo apt-get remove nodejs should get rid of the default package.

I can confirm that the adafruit repo installs on well my hardware.
Like Carsten, I get node v0.12.6

Pi 2 Model B v1.1
OS: Raspbian GNU/Linux 8.0 (jessie)

Thanks EVERYONE for verifying the install process!
I updated the README.md as follows:

How to install on a Raspberry Pi

  1. Use NOOBS 1 to install the base Raspian image.

  2. Update the system software.

    sudo apt-get update
    sudo apt-get upgrade -y
    
  3. Remove the default nodejs instance and replace it with v0.12 or higher.

    sudo apt-get remove nodejs
    curl -sLS https://apt.adafruit.com/add | sudo bash
    sudo apt-get install -y node
    
  4. Get the latest OpenHybrid Object code and download dependencies.

    git clone https://github.com/openhybrid/object.git
    cd object
    npm install
    
  5. Run the OpenHybrid Object code.

    node server.js
    

Welcome to the community!

As @V_Mohammed_Ibrahim pointed out, this thread has more info on the GPIO support: Raspberry Pi GPIO Support and a video demo is here: https://flic.kr/p/BgiNms 11

Also, make sure you check out valentin’s videos (especially http://openhybrid.org/adding-object-and-marker.html 9 )

Fortunately, valentin merged my pull request into carsten’s new Hardware Interfaces branch, so you can get the latest code by running a git checkout beta_hardwareInterfaces. The config.json file allows you to define your I/O pins.

@KevinOrtman i tested the manual on my pi B+ v1.2 it is working ,

i installed the Raspbian directly to the SD card using win32disk imager, ( didnt have Noobs )
ran into an issue at npm install ( waited half hour to complete but still didnt complete)
after using these steps npm install worked fine ( took only about 5 mins)

sudo apt-get install libasound2-dev
sudo apt-get install npm

this might have occurred because i didnt use NOOBS

@KevinOrtman, thanks to you and the others this newbie is having some success. I have plinked around and created a few test interfaces and successfully gotten overlay buttons, sliders, and other oddball graphics to overlay, (simplistically, I know). I learned enough git to get the beta branch down and working, too. The Pi + Reality Editor solution is really surprisingly robust in finding targets and applying overlays!

My next goal is to control a white Hue (dimmer) with a slider. I’ve got the control slider, but am unsure where to start to tie in the Hue REST interface (curl scripting?). Does it all go into index.html – that seems wrong, the object control should talk to the Pi, and the Pi should talk to the Hue? I looked through the Arduino Yun Example for twiddling analog outputs for a LED, and I gather the Web part at the bottom goes in index.html to add some meat to the slider object overlay. But where in the Pi code does the back-end go? There is some Arduino code in the example, but no file identifier, and the helpful link to instructions goes to 404.

If you have time to advise, I would much appreciate it, else after some errands today I’ll go read some of the Pi code framework and see what I discover.

Thanks!
Peter

hi @psomdecerff the javascript code at the bottom of the index.html helps in communication between the AR element and the hybridobject , you can do the same for the pi ,
but the pi does not have direct analog output as you might know , you may need DAC to use analog values ,the GPIO test interface made by @KevinOrtman is in the beta_branch , you can use the GPIO of the pi by entering info for the pins in the config.json file
let me know if this helps :smile:

@psomdecerff, I gather from the other thread that you are well on your way to communicating with the Hue via Carsten’s HW Interface example, is that correct?

If you still need help or advice, we’re here and happy to help - start a new thread or message us directly?

I’m in good shape - thanks! I suspect that those familiar with the tools and the codebase could have done what I did in a fraction of the time. I’m just learning as I go, as this is my first dive into open source, and it’s working out.

6 months later

So rasberry pi 3 has now wifi included that will be easier to setup? the process will be different?

@fabianrios no it will be same, the install process will be the same for PI 3,
Only difference is you don’t need an external wifi adapter or LAN cable to connect to network as there is inbuilt wifi .
Right @valentin ?

Thanks for the reply, I have access to one PI 3. My question is, in that case the Arduino Yun is still a necessity to make the slider example? or is it possible to use the PI 3 for that purpose as well using something like Wiring Pi?

@fabianrios You can have the slider exapmle on the PI 3 also , but as far as i know the PI has only digital pins ,so you cannot have the full range of control for the slider, Instead you can either use the already existing PI hardware interface or create hardware interface for yourself to obtain ON/OFF functionality with the slider
However if you really need the full analog range function of the slider , you could use some kind of A/D converter :slight_smile:

@valentin the PI 3 is great, it has inbuilt wifi module like the Yun and also more power

I don’t have an arduino Yun to compare, but thanks to the hardware on it I think it is faster.

The Arduino takes around 2 minutes to boot up to the point that the open hybrid server is running.
Anything faster than 2 minutes would be amazing! :slight_smile:

@valentin the PI boots in about the same time ,maybe a little less
And it might change with the speed of the card
Also we can set the server to start on boot in which case the server is running as soon as the PI is up.

But the PI defi definitely has advantage over yun except that it does not have analog pins