Developer docs: How to edit and test a PFC2 firmware module


This is for developers who would like to help improve the PFC2 firmware modules that run on the Arduino.

Here is a gist I wrote that explains how to modify one of the existing PFC2 firmware modules:

The process for adding a firmware module would be similar, except you might need to make an additional pull request to modify the default.json and personal_food_computer_v2.json fixture files in the openag_brain repository. Assuming you wanted to add a new sensor, you would need to define a firmware module type for it in default.json and possibly configure an instance of the module in personal_food_computer_v2.json.

edit: If you just want to add a sensor to your own custom hardware build, making your own fixture is probably the best way to do it (see comments below). Modifying personal_food_computer_v2.json would make sense if you were helping to implement changes to the PFC2 design.


Should we be adding firmware_modules to personal_food_computer_v2.json?
I feel that is for the kit hardware which has a specific set of sensors.
If you have extra sensors/actuators I think the better way to go about this is to either define your own fixture in ~/path/to/your_fixture.json and then either calling

$rosrun openag_brain main -F ~/path/to/your_fixture

$ openag db load_fixture ~/path/to/your_fixture
$ rosrun openag_brain main

as shown in


Should we be adding firmware_modules to personal_food_computer_v2.json?

Thanks for pointing that out. When I said “and possibly…”, that’s what I had in mind. In many cases, using a different fixture would be better.


The approach you suggested sounds good.


Since whatever ends up on the db is just a union of the multiple fixtures you’ve loaded (although if there are conflicting ones the fixture that gets loaded last is prioritized) I think defining your own fixture should be a good solution for most applications.

Awesome writeups though, I’ve been finding them very helpful :smiley:


Thanks. It’s great to get feedback from people who have been doing this for longer. I’m just getting started and learning my way around.

Also, for people who haven’t seen the thread about “Hackers needed: help run 2.0 software on 1.0 HW”, it has lots of information about writing firmware modules. In particular, I found this comment to be helpful: