GithubHelp home page GithubHelp logo

RS485 Connection about balboa_worldwide_app HOT 13 CLOSED

ccutrer avatar ccutrer commented on September 3, 2024
RS485 Connection

from balboa_worldwide_app.

Comments (13)

EricAgostinelli avatar EricAgostinelli commented on September 3, 2024

If there is a Y-Cable that goes to the onboard control panel,

use this: Molex Adapter

and then I also got one of these to power the Pi directly from the spa: DC Step-Down Transformer

I then used a USB to 485 converter so I didn't have to tie to the board directly. USB Converter

Though to be honest, I have not gotten the program to work. I kinda gave up and am using the pi to send the 485 protocol over ethernet via to break it apart and use it via a Crestron control system (which has been a slow progression). One of these days I'm going to get another pi and try it simultaneously.. If anyone has better advice on better configuring the pi to work let me know :)

from balboa_worldwide_app.

bggardner avatar bggardner commented on September 3, 2024

Without knowing the make/model of your spa, or seeing photos, it would be hard to tell if it uses RS-485 at all. Assuming it does, the 4-pin connector used by the WiFi module (an probably any other similar connector on the motherboard) is an RS-485 port. See the relevant section of the wiki for the pin-out.

I am using this USB adapter with this cable (cut in half) and they've been working great for over a year.

from balboa_worldwide_app.

JochenKoehler69 avatar JochenKoehler69 commented on September 3, 2024

Hi Eric,
do I understand correct, that the control panel of the spa is also connected via RS485 and you can just jump in?
I just connected the adapter to the plug for WLAN module but I do not see any reaction.
However is there any "verbose" mode of the software to be able to see if there is a connection to the RS485 adapter and that MQTT data is sent out?
There are so many error possibilities ...

from balboa_worldwide_app.

JochenKoehler69 avatar JochenKoehler69 commented on September 3, 2024

Meanwhile I took some photos of the control unit:

This is the description sticked to the inner side of the control unit:
IMG_20211022_153446937
IMG_20211022_153651394

I tried to connect the RS485 adapter both to the J34 connector (for Wifi Module) ...

IMG_20211022_153731167

... and to an existing Y-cable (where the technician of the spa said that this is for a second conrtol panel

IMG_20211022_154416231

In both cases it seems that I get non sense from the adapter (I added a stderr.puts(@buffer) command in the file clients.rb after line 29.

The output looks like this:
▒ |R▒@▒▒G▒▒ |R▒▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒ ▒ ▒▒ |R▒▒▒ ▒▒ |R▒▒▒ ▒t▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒ ▒ ▒▒ |R▒▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒ ▒▒ ▒▒ |R▒▒▒▒G▒▒ |R▒▒▒▒G▒▒ |R▒▒▒ ▒▒▒▒▒ ▒▒ ▒ ▒▒ |R▒@▒ ▒▒▒G▒▒▒ |R▒@▒▒G▒▒ |R▒▒▒ ▒ ▒▒ ▒▒▒▒▒▒ ▒▒ ▒ ▒▒ |R▒@▒▒G▒▒ |R▒▒▒ ▒▒▒ |R▒▒▒ ▒▒▒▒▒ ▒▒ ▒ ▒▒ |R▒@▒▒G▒▒ |R▒▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒ ▒ ▒▒▒ |R▒▒(vt▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒ ▒▒▒▒▒ ▒▒ ▒
Any suggestions?

from balboa_worldwide_app.

bggardner avatar bggardner commented on September 3, 2024

First, @buffer is in raw bytes, so print the hexadecimal values, not ASCII rubbish with puts.

Since it appears you are able to read bytes at all, my best guess would be that the RS-485 wires are reversed. Try swapping them. You could also just be picking up noise if any of the wires are loose.

from balboa_worldwide_app.

JochenKoehler69 avatar JochenKoehler69 commented on September 3, 2024

Thanks for your advice - I swapped the wires and communiation with RS-485 is working finally :-).
Also the communication with my MQTT-server is running now.
My (hopefully last) problem is to start the service with "systemd".
When I try to start the service I get this error messages in the journal:

Oct 25 16:30:06 raspi-swimspa bwa_mqtt_bridge[3424]: /home/pi/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/rubygems.rb:281:in find_spec_for_exe': Oct 25 16:30:06 raspi-swimspa bwa_mqtt_bridge[3424]: from /home/pi/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/rubygems.rb:300:in activat
Oct 25 16:30:06 raspi-swimspa bwa_mqtt_bridge[3424]: from /home/pi/.rvm/gems/ruby-3.0.0/bin/bwa_mqtt_bridge:23:in `'
Oct 25 16:30:06 raspi-swimspa systemd[1]: bwa_mqtt_bridge.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://www.debian.org/support

-- An ExecStart= process belonging to unit bwa_mqtt_bridge.service has exited.

-- The process' exit code is 'exited' and its exit status is 1.
Oct 25 16:30:06 raspi-swimspa systemd[1]: bwa_mqtt_bridge.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support

-- The unit bwa_mqtt_bridge.service has entered the 'failed' state with result 'exit-code'.
Oct 25 16:30:06 raspi-swimspa systemd[1]: Failed to start Balboa Spa MQTT Bridge.
-- Subject: A start job for unit bwa_mqtt_bridge.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support

-- A start job for unit bwa_mqtt_bridge.service has finished with a failure.

-- The job identifier is 44076 and the job result is failed.

My bwa_mqtt_bridge.service file looks like this:
`[Unit]
Description=Balboa Spa MQTT Bridge

[Service]
User=pi
ExecStart=/home/pi/.rvm/gems/ruby-3.0.0/bin/bwa_mqtt_bridge mqtt://0.0.0.0/ /dev/ttyUSB0
Restart=always
RestartSec=10s
Type=notify
NotifyAccess=main
WatchdogSec=60

[Install]
WantedBy=multi-user.target
`
(the IP of the server is changed here)

Starting the script from the command line is working well.

Any further hints? Thank you very much

from balboa_worldwide_app.

ccutrer avatar ccutrer commented on September 3, 2024

It sounds like you're using RVM, and when run from systemd the RVM context isn't fully set up. I don't use RVM, but https://rvm.io/deployment/init-d may be relevant.

from balboa_worldwide_app.

JochenKoehler69 avatar JochenKoehler69 commented on September 3, 2024

@ccutrer, thanks for the hint. I installed RVM "by accident" because this is what I found to install Ruby on a Raspberry. It's not mandatory for me. Do you have any other suggestion how to install Ruby without RVM?
However I found out that starting the script with "sudo" is causing the same error on the command line - so maybe the user setting (user "pi") is somehow ignored in systemd?

from balboa_worldwide_app.

ccutrer avatar ccutrer commented on September 3, 2024

apt install ruby should be sufficient. It may be a bit older version of Ruby (2.5 at last check), but should still be compatible.

from balboa_worldwide_app.

JochenKoehler69 avatar JochenKoehler69 commented on September 3, 2024

I tried this already (in fact it is Ruby 2.5), but got an error when installing this gem. Unfortunately I made no copy from the error message ... there was any file missing during the installation process.
I try now to install Ruby with RVM in a multi-user "version" - let's see if this will work.

from balboa_worldwide_app.

JochenKoehler69 avatar JochenKoehler69 commented on September 3, 2024

Finally it's running !!!
Some extra settings in the system and in the "systemd" file were necessary to make it executable.
However I had to do two additions in the source code:

  • In client.rb "require 'uri' has" to be added
  • In bwa_mqtt_bridge "require 'set'" has to be added

May be you could add this to your code. I habe Ruby 3.0.0 installed.

If it is of any interest I could contribute with a small description about how I made it up and running on the raspberry ...

Thanks a lot for your support and the great script :-)

from balboa_worldwide_app.

ccutrer avatar ccutrer commented on September 3, 2024

changes made and 1.2.5 published. thanks!

from balboa_worldwide_app.

EricAgostinelli avatar EricAgostinelli commented on September 3, 2024

Finally it's running !!! Some extra settings in the system and in the "systemd" file were necessary to make it executable. However I had to do two additions in the source code:

* In client.rb "require 'uri' has" to be added

* In bwa_mqtt_bridge "require 'set'" has to be added

May be you could add this to your code. I habe Ruby 3.0.0 installed.

If it is of any interest I could contribute with a small description about how I made it up and running on the raspberry ...

Thanks a lot for your support and the great script :-)

Would be great to see a how to/tutorial/walk through for 485 Communication.

from balboa_worldwide_app.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.