New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python peripherals #278

merged 36 commits into from Jun 26, 2017


None yet
6 participants

jakerye commented Jun 14, 2017


This change introduces a way to interface with sensors and actuators directly from the pi. The goal of this is create the option to run the brain without the use of an arduino.


Before the bespoke serial messaging protocol, the communication between the raspi and arduino was unreliable. This was a parallel development effort to create a stable system as fast as possible. It was also required for integrating the brain box code into the main software stack. Furthermore, running all code on a single board simplifies the system.


New nodes are added and named with a functional prefix. E.g. sensor_am2315 or actuator_relay. Nodes manage rostopics and event loops. The nodes call a helper module for each device (e.g. am2315 or relay) found in the peripheral directory. It is here where all the code for actually interfacing with the device sits.

This PR interfaces with the following:

  • Sensors

    • am2315 temp & humid sensor
    • ds18b20 water temp sensor
    • mhz16 co2 sensor
    • atlas ph sensor
    • atlas ec sensor
  • Actuators:

    • hid 16 channel relay (driven via usb)
    • individual relay (driven via gpio)
  • UI:

    • touchscreen (official raspberry pi 7") that simple displays the sensor values


Running timing sensitive code will not be possible from this approach.


  • Bespoke serial protocol w/arduino
  • Beaglebone where timing sensitive code runs on one of the x2 programable real time units (PRUs)

@sp4ghet sp4ghet requested a review from rbaynes Jun 14, 2017


This comment has been minimized.

CarrierDirectJoe commented Jun 14, 2017

So this is going to pull out support for PFC1? I'm finding myself stuck trying to figure out where I'm going to take the legacy hardware. There are a number of design flaws including weak sensors in PFC1 but the cost to retrofit it to be entirely a PFC2 ecosystem I might as well just toss them and build PFC2s. At least the PFC1's have working lights tho. :-)


This comment has been minimized.


sp4ghet commented Jun 14, 2017

We're kind of exploring a couple different configurations to see which method of implementation will provide the most value for us in regards to hardware. Either way, we will probably be heading in a way where anyone with different hardware needs to write a way to interface that with ROS.

The contract will be publishing and subscribing to environmental variable topics defined under the launch/personal_food_computer_var_types.yaml and everything else aside from that will be considered free reign.
The way I would do this for PFC1 hardware would probably be to write a node that handles the arduino (similar to nodes/ under the bespoke_serial branch) and an accompanying Arduino sketch. (The analogy for this would be hardware manufacturers writing firmware and a driver for their hardware).

gordonbrander and others added some commits Mar 27, 2017

Fix problem with am2315 base class
and only publish when we have data
rosdep install --from-paths src --ignore-src --rosdistro indigo -y -r --os=debian:jessie
# Source ROS environment
source /opt/ros/indigo/setup.bash

This comment has been minimized.


rbaynes Jun 22, 2017


Is this the correct path? You sure it shouldn't be source ~/catkin_ws/devel/setup.bash ?

This comment has been minimized.


sp4ghet Jun 23, 2017


For this install script it's the correct one, but it no longer works with this install script so I will rewrite accordingly


LGTM. I'll leave it up to @spaghet to merge this if it is ready.


This comment has been minimized.


edcafenet commented Jun 23, 2017



@sp4ghet sp4ghet merged commit 7518fd1 into develop Jun 26, 2017

@sp4ghet sp4ghet deleted the python_peripherals branch Jun 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment