Testing Channels without Recipes


Is there a testing environment, command module, or interactive environment that a user to test the various signal relay and arduino channels to verify that each component is working correctly? I’m interested in testing individual components without having to flash a new recipe each time I want to test a particular component. For instance, I want to be able to push a button or send a command to turn on the ‘pH up’ pump for either a set duration of time or until I send a command to turn it off. I then want to initiate a pH measure to calibrate the ‘pH up’ pump. Then I would like to do the same with the ‘pH down’ pump.

This whole process should enable me to make sure that all of the components have been constructed, installed, and wired correctly, and to help calibrate the components for the size of box created. Has anyone coded this yet or does it need to be created?


Earlier this year, Jake used to have a repo with a special Arduino sketch for testing the hardware. But, I think all the firmware has totally changed since then. Now, the tests in the openag_brain repository seem to be mostly higher level ROS stuff.

With the caveat that I don’t have a PFC, I haven’t tested this procedure, and what I’m saying is based primarily on reading the code on github, I would suggest:

  1. Install the right version of the PFC environment from source to match your hardware. I’m not sure exactly what that will entail, but the point is to avoid a Docker install because it will run ROS automatically, the python packages may be buried in a container where you can’t import them conveniently, etc.

    These links might help you figure out the right way to make sure you’ve got the right PFC software stack installed to match your hardware:

  2. Read the python code for the ROS nodes in the github openag_brain repository to see how the nodes make use of the openag_brain.peripherals python package package. You should see stuff like this:

    from openag_brain.peripherals.relay import Relay
    from openag_brain.peripherals.hid_relay_16 import HidRelay16
    from openag_brain.peripherals.am2315 import AM2315
    from openag_brain.peripherals.ds18b20 import DS18B20

    To do the kind of testing you want, I think you’ll need to imitate the ROS node code in your own scripts–not including the ROS-specific parts.

  3. Go have a look at the code for the openag_brain.peripherals package to see how it works.

  4. Make sure the openag_brain.peripherals package got installed in a place that’s in your python path. I haven’t gone through the installation scripts to see exactly what happens, but you might need to activate a virtual environment, run a startup script, or whatever to get the package in your python path. If you try to do this with a Docker install, I’m guessing you won’t have the right packages in your normal shell path.

  5. Fire up a python interpreter, import something from openag_brain.peripherals, and see what happens.


So I think part of the problems I’m finding @wsnook @rbaynes is that there is a usb.core module. If I try playing around with the openag_brain peripherals they all seem to work except for the HidRelay. I think this is part of the reason I’ve been having issue getting the software working properly. Here’s some python:

>>> from openag_brain.peripherals.relay import Relay
>>> from openag_brain.peripherals.hid_relay_16 import HidRelay16
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
 File "/home/pi/catkin_ws/src/openag_brain/src/openag_brain/peripherals/hid_relay_16.py", line 12, in <module>
    import usb.core
ImportError: No module named core
>>> from openag_brain.peripherals.am2315 import AM2315
>>> from openag_brain.peripherals.ds18b20 import DS18B20

I believe that usb is pyusb which had two major versions 0.4 and 1.0.2. Version 0.4 did not have the ‘core’ and ‘util’ modules but v1.0 does contain them. However, v0.4 comes preinstalled with Raspbian. So I had to update it to v1.0 before applying @rbaynes installation steps here https://wiki.openag.media.mit.edu/contributors/rob.baynes/rpisetup

 ~/catkin_ws/src $ sudo pip install pyusb --upgrade
 Requirement already up-to-date: pyusb in /usr/local/lib/python2.7/dist-packages
 Cleaning up...

>>> pkg_resources.get_distribution("pyusb").version

So it appears the module is supposedly installed correctly but not working properly. Has anyone else experiences this issue? I think this is causing my recipes to fail. Alternatively, can anyone share a working image that I can flash to my sd card?


That sounds plausible. The MIT folks haven’t had much to say here on the forum in the past few months. I haven’t seen anything about what their plans are for ongoing documentation and support around the PFC v2.1 design. I think they may be primarily focused on food server projects for the container farm they’ve been building.


Hey @wsnook!

You are correct - after the release of the PFC v2.1 documentation, we have slowed down a bit on the PFC front. That doesn’t mean that we are stopping work on the PFC, we have just had to temporarily shift our focus a bit.

Currently the team at MIT is diligently working on a couple of projects that were highlighted by the community as being critical to the progression of food computing - namely improving the food server and getting corresponding documentation up and ready for release, and working on backend data and the cloud platform (with some much appreciated help from the community).

We’re hoping to share more about these projects in the next newsletter, but in the meantime appreciate your patience!