Raspberry PI + Arduino - Serial Binding

  • Platform information:
    • Hardware: Raspberry PI 3 Model B
    • OS: openHABian
    • Java Runtime Environment: 1.8.0_152
    • openHAB version: openHAB 2.3.0-1 (Release Build)

Hi,

I’m currently in progress of creating connection between Raspberry PI and Arduino MEGA through serial connection. As I asked for help before, I’m seeking for your help once again.
I’m currently connecting everything together and I got stuck, when I was creating Arduino as an item to /etc/openhab2/items ($OPENHAB_CONF/item).

So what is currently configured.

  1. openHABian 2.3.0-1 with PaperUI
  2. Default config
  3. Arduino is connected to RPI and I can see communication through minicom (verified port /dev/ttyACM0 )
  4. Installed binding-serial1 - 1.12.0 (through PaperUI), but I cannot see it in http://openhubIP:8080/paperui/index.html#/configuration/bindings - which is weird
    (reinstalled, but it’s still not there)
    I cannot download it from github, because it’s not in repository
  5. I created _ start.sh_ (in /opt/openhabian/) with -Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0 and I even tried EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0
  6. I set sudo usermod -a -G dialout openhabian and sudo usermod -a -G dialout openhab
  7. I created a item called arduino.item with String Arduino "Arduino [%s]" (arduino) {serial="/dev/ttyACM0"}

As a result I should get events logs with arduino outputs, but that’s not happening. Here is arduino code:
int weight = 125;
int temperature = 39;

void setup() {  
  Serial.begin(9600);  
}  
  
void loop() {  
  Serial.print("weight:");  
  Serial.print(weight);  
  Serial.print("g_temperature:");  
  Serial.print(temperature);  
  Serial.println("C;");  
  
  delay(10000);  
}  

Do you guys know, what should I do to get it working?
BTW: I’m using this tutorial, which is quite helpful ^^

I know I am a little off topic but, what is your end goal again? It was not clear to me in the first post and now you are basically seeking help on the same issue.

Everything I see looks like you are taking the long way round the block. I don’t know your end goal so I can’t fully comment.

What is the end goal again?

1 Like

Can you post the serial.cfg file, please?

I’m trying to find out, where did I make a mistake. In my previous forum I tried to find out If and how is possible to connect together. I read the forums and tried it… but I somewhere did the mistake. :confused:

As soon as I get home I will post it! Thanks

Where serial.cfg should be saved?.. I can’t find it. I thought that it should be in /etc/openhab2/services or /usr/share/openhab2/addons, but It’s not there. I wanted to reinstall bundle through SSH, but … that’s another issue… I cannot execute feature:list | grep ^openhabian :confused: I’m really confused right now…

It should be in etc/openhab2/services
If it is not there then the binding didn’t install properly
I think you can always try to create it manually
Follow the examples in the binding docs

I’m trying to find out, where did I make a mistake.

the question from Danny was, what is your goal with your program.

Finding you rmistake is one thing, if we understand your goal, we might help you with your goal in an simpler way. When it’s simpler, you have less risk in mistakes + might be less stress on your openhab system.

1 Like

Alright… So … Basically what I’m trying to do is connect RPI to arduino, so I could send values from sensors to RPI through serial (usb) connection. Values should be displayed in Paper UI (or similar GUI) and also from Paper UI I want to be able send values to arduino, where I’m able to work with them. (I have in mind some basic number slider or numeric up down)

Right now, I manually downloaded serial binding to /usr/share/openhab2/addons, but nothing looks differently. (even after restart)

Why I cannot execute command as log::xxxxx , bundle:xxxxx, feature::xxxxxx?

is there a particular reason to use RPI connection?
I’m sending requests to arduino’s using MQTTT
in my case the arduino’s are on the same network around the house.
So no need to have both close to eachother.

It is part of the task which I need to accomplish :confused:

I have the same setup as you, did you find your problem yet? I encountered similar problems to the ones your describing, for me it was the rpi going corrupt due to power cuts. A clear sign for me was a problem with the log files.

The solution in my case was to reinstall the rpi completely using openhabian (which is not that much work especially if you’ve done it before) and then putting back the configuration files.

Without log files it’s difficult to check what’s going wrong.