Openag_brain is not working


Hi all,
I have installed and compiled the brain software on a Raspi 3 and Jessie lite os apparently without errors. I have choosen to not use the dockers image because I want to contribute to the developing of this project.

The openag_brain is running as a service and it’s launched during the boot sequence.

Using a web browser I have verified the couch db heartbeat is working on port 5984 because I get:

Unfortunately I get these errors when I try access the openag_brain API (IP:5984/_openag):

I cannot figure out what is going wrong.

Can you please advice where I have to investigate ?

Thanks, Fabio


Hey there,

I’m glad my service/daemon thing is working :slight_smile:

So I had this problem as well, and it seems like you need to run some init scripts before openag_brain can start working.
I talked with Gordon a little bit and it seems like he plans on doing some major rehauls to this part of the software so I assume this will be more streamlined at some point, but here’s what I did to get it working.

$ source ~/catkin_ws/devel/setup.bash
$ rosrun openag_brain install_pio
$ rosrun openag_brain load_fixture default
$ openag db init
$ cd && mkdir -p pio && cd pio && openag firmware init
$ systemctl restart openag.service

see if that works?


Unfortunately not.
I’m trying to understand who is refusing connection. Is it something related to serial port where Arduino Mega must be connected ?
Or it could be related to pi account restriction (it’s not root) ?

Anyway, I think pio was already installed by the last version of the openag_brain_install_rpi installation script.


Hi fdrago, assuming you have the sensors for V2 plugged into your Arduino the default fixtures file will populate the couch database with the code that will load the driver code for the sensors into the Arduino.
You can check which sensor drivers are going to be loaded by browsing to http://localhost:5984/_utils/index.html, where you will see the Couch DB, databases.
If you double click the , firmware_module, database you should see a list of names which should match your connected sensors. At least one of them should match in order for data to be stored in, environmental_data_point, from where the UI can then display it. More info on the wiki about fixtures.
I stumbled on a fix when having possibly the same problem. I tried opening another terminal and typing,

platformio serialports monitor

to see if there was any data coming from the Arduino serial port connection to the raspberry PI. The connection error cleared and data from the sensors was stored in the database.
The ui also started showing traces.[quote=“JohnB, post:12, topic:859”]
This screen shot from the, Brain, is showing the data traces from the V1 sensors connected to the arduino, A TSL2561, dht22, dfr0161 and a simple thermistor based home made temperature sensor which is intended to be used to show water temperature.

This is only part of the story as the data from the sensors has to be connected to the actuators so that when the system parameters change they can be acted on to bring them back to prescribed values, following instructions from the plant recipe.

2016-11-20-162025_1280x1024_scrot.png1280x1024 75.1 KB

It’s only a short term fix, the reason for the behaviour is still being investigated. You can follow progress on GitHub.

PS Just re-installed the latest openag_brain and openag_python code and the unable to sync error is still there with my setup…


Hi @JohnB, many thanks for your advice. Now I have understood what is my issue: I’m missing the connection with Arduino.

I have started to setting up the raspi environment and I was tying to check if everything it’s working ok. Thanks to you now I know the UI works only when all systems (raspi and arduino) are working.

Since I can access the _utils section and I can see the list of sensors I’m assuming that raspi is working ok, even if the IP:5984/_opeang is not working anymore after have launched the commands suggested by @spaghet.

Tomorrow I will set up the arduino part.


I am having a similar problem (though running in Docker). It does appear that pio is already installed. I tried platformio from another window (which gave data but errored out with another process using the same connection), but still get an error on this command. The output is:

rosrun openag_brain install_pio
Reading package lists… Done
Building dependency tree
Reading state information… Done
python-virtualenv is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 144 not upgraded.
Running virtualenv with interpreter /usr/bin/python2
New python executable in /home/pi/pio_env/bin/python2
Not overwriting existing python script /home/pi/pio_env/bin/python (you must use /home/pi/pio_env/bin/python2)
Installing setuptools, pip…done.
Requirement already satisfied (use --upgrade to upgrade): platformio==2.11.2 in ./pio_env/lib/python2.7/site-packages
Cleaning up…
Installing toolchain-atmelavr package:
Already installed
The platform ‘atmelavr’ has been successfully installed!
The rest of packages will be installed automatically depending on your build environment.
pi@6b2a2ddd89ca:~ rosrun openag_brain load_fixture default Applying fixture default environment [####################################] 100% software_module_type [####################################] 100% firmware_module_type [####################################] 100% software_module [####################################] 100% pi@6b2a2ddd89ca:~ openag db init
Error: Local database “http://db:5984” already initialized. Switching local databases is not currently supported
pi@6b2a2ddd89ca:~ cd && mkdir -p pio && cd pio && openag firmware init Initializing PlatformIO project OpenAg firmware project initialized! pi@6b2a2ddd89ca:~/pio systemctl restart openag.service
Failed to get D-Bus connection: Unknown error -1


Hi, I don’t think there’s any point to running openag_brain as a service if you’re using docker.

$ docker-compose up -d already does essentially the same thing for you.

I’m assuming that the linux image in the docker container isn’t running systemd (seems similar to this topic) so it’s giving an error.


hi webbhm

I have the same issue
Also running in docker

Where you able to fix it?


No, and I am feeling a bit stuck. Lets see if you are getting the same thing:

docker ps

This shows two containers, the brain and the database

docker exec -it openagbraindockerrpi_brain_1 bash
rostopic list

This shows three topics:


rostopic echo diagnostics

This gives the following error, which I think is the root of the problem. If ROS cannot talk to Arduino, then I don’t think anything further is happening (why no more topics). What is not clear is why other paths can talk with Arduino.:

seq: 2
secs: 1483971939
nsecs: 579736948
frame_id: ''

level: 2
name: rosserial_python
message: no sync with device
hardware_id: ''
    key: last sync
    value: Mon Jan  9 14:25:24 2017
    key: last sync lost
    value: Mon Jan  9 14:25:39 2017

platformio serialports monitor

This returns data, but then errors out (contention over the port?):

— exit —
Exception in thread rx:
Traceback (most recent call last):
File “/usr/lib/python2.7/”, line 810, in __bootstrap_inner
File “/usr/lib/python2.7/”, line 763, in run
self.__target(*self.__args, **self.__kwargs)
File “/home/pi/pio_env/local/lib/python2.7/site-packages/serial/tools/”, line 452, in reader
data = or 1)
File “/home/pi/pio_env/local/lib/python2.7/site-packages/serial/”, line 490, in read
’device reports readiness to read but returned no data '
SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)

rostopic echo rosout
This is just another shorthand for and 5000 is redirected to 5984/_openag; which is not found via my browerser.

seq: 2
secs: 1483976141
nsecs: 431538105
frame_id: ‘‘
level: 2
name: /api
msg: API now listening on
line: 300
topics: [’/rosout’]

seq: 14
secs: 1483976309
nsecs: 496736049
frame_id: ‘‘
level: 8
name: /serial_node
msg: Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino
function: run
line: 432
topics: [’/diagnostics’, ‘/rosout’]


Inside your container you could kill the main ROS processes, then try restarting the main process again. Source

killall -9 roscore
killall -9 rosmaster
~/catkin_ws/devel/ rosrun openag_brain main ...

Or you could restart the container entirely:

docker restart openagbraindockerrpi_brain_1

If you are using docker compose, you could also do:

docker-compose restart

If restarting doesn’t work then you can kill the container (and then later recreate it using docker-compose):

docker kill openagbraindockerrpi_brain_1

Good luck!


@david - Thanks for the tips, but restarts, stop/start, etc (including full reboot) are not changing anything. Logs still indicate that there is “no sync with device” ([ERROR] [WallTime: 1481094004.657105] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino), even though platformio can pull back data.

p.s. within Docker (docker exec -it openagbraindockerrpi_brain_1 bash) killall seems to be an unknown command.


@webbhm You could try stopping and then removing the containers in order to have a fresh state and build them again using your installation method.

docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)

I’m curious, could you also share how are you installing stuff? Are you installing via the Dockerfile, via the ./ or by hand?


Some days the easiest (and best) solution is to not fix it. I formatted another SD card and rebuilt the brain, and rostopic list is giving me the whole set of default sensors.
It took several tries of docker-compose up -d (time-outs, needed to change to a better network node), but when it finally finished, everything was good. I am copying off the SD so I have several ‘baseline’ sets, and can start modifying from there.
Thanks for all the help and suggestions.


Had the same issue,

probably just the git repo being out of date (~/catkin_ws/openag_brain/)


Forgive my ignorance, I’m diving into the new software for the first time.

As a person with a similar issue, will the list of default sensors show up in firmware_module or firmware_module_type when configured correctly? I can’t seem to get anything to show up in firmware_module, but they are all present in firmware_module_type. I have the food computer version 1.0 built, and I’m trying to adapt it to the new software without changing all of the sensors.


The repository code (default.json) has the firmware_module_type, which defines the ‘class’ of sensors. There is nothing in the file for firmware_module, which would be a particular ‘instance’ of a physical sensor you have hooked up to your Arduino. Assuming your sensor type is desecribed in the file, you have to add the firmware_module information for your particular sensors (ie. openag doesn’t know the particular pins/address for your particular your sensor). This is not ‘ready-to-run’ but a do-it-yourself kit.
Check for examples.


Gotcha. Thank you for the direction.


After a couple of weeks of beating on this I end up continuing to get this error as mentioned earlier in the thread:

Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

I have tried these combinations:

  • Running as a docker image with the full Jessie desktop
  • Running as a docker image in the Jessie lite
  • Running a developer source install using Jessie lite

For my setup I have the arduino mega plugged into the PI with nothing attached to the mega. Are sensors required to get the ROS arduino syncing talking back to the master running in the PI?

I have tried listening directly with these commands:

rosrun rosserial_python _port:=/dev/ttyACM0

rosrun rosserial_python _port:=/dev/ttyACM0 _baud:=57600

rosrun rosserial_python _port:=/dev/ttyACM0 _baud:=115200

Plus all the other bandwidths listed in the Arduino Serial Monitor from 9600 to 115200.

One thing that I did early on was that I uploaded a small Arduino sketch to test the temp/humidity sensor. I wouldn’t think that this would foul up the PI/ROS firmware flashing from that point on though. I have been using the command below to flash the arduino. But I don’t know of any way for sure to verify that the Arduino has the image.

openag firmware flash -f ~/catkin_ws/src/openag_brain/launch/personal_food_computer_v2.yaml

My build has a limited set of hardware thus far. I plan to run multiple DWC bins in a 2’ x 4’ grow tent. I am intending to use the food computer brain to monitor the tent environment and exhaust the tent when the temperature rise too high. I realize that this setup is total overkill for only that need, but we’ll see where I end up as this project progresses. :slight_smile: I want to have all the core brain pieces for future upgrades.

thx for all the work that everyone has done this far in this project. Also thx for any help in getting this thing running.


Try unplugging the Arduino board from the Pi, and put it into a different USB port. I had this problem occasionally, and that seemed to fix it for me. You may have to do this fairly often.
If you think the Arduino itself is the problem, check it out by loading a sketch from another machine (PC) using the Arduino SDK; also simply install the Arduino SDK on the Pi and loading a sketch. If these are working, it is not a problem with the Arduino board. You can also simply open the Arduino serial port monitor to see if data is flowing.


Yes, @webbhm, I did have a USB port issue occur on one occasion. The arduino got registered as /dev/ttyACM1. That issue can be detected by running: ls /dev and checking to see that the arduino is connected as /dev/ttyACM0 and not /dev/ttyACM1.

I’ll try the Arduino SDK suggestion.

A couple more questions:

Does anyone know if as part of the setup there are a series of checkpoint commands that could be run to verify that the configuration is in a valid state?

When it comes to resetting a failed setup what steps need to be done to sanitize the environment? It seems like the steps would be different with a developer install vs the docker container install. With docker is it just a matter of deleting the created containers (as suggested with the commands from @david above)? When running docker is there anything that gets done to the core OS that might block the docker reset from working?

In my primary job we use a series of smoke tests to verify that deployments are successful. I am familiar setting up that functionality within a .NET environment. This ROS/Python setup is new to me and I have not wrapped my head around the project enough to create that type of diagnostics.

In general is there simply a troubleshooting area?

Lots of questions, maybe I should create a new forum thread on the topics of troubleshooting and post-install verification.