OpenSprinkler Forums Hardware Questions OpenSprinkler Beagle (OSBo) Unified Firmware and BBB IO


Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #38717


    I just brought my OSBo firmware up to the unified 2.1.5 and it is working very well. So now it’s time for me to start mucking around and break a few things.

    First, a question: In the web interface, is there a way to access the mini-relay?

    Second, a request: Part of the reason for going with OS was to be able to add on some functionality. On my ‘to do’ list is to add a local temperature sensor, attach a relay board, add a garage door sensor, and some messaging capability. I started working to add some functionality to the Python code, but now need to start over with the unified firmware. An example for how to extending the current code to access the additional interface pins on the BBB would be very useful. Even some pointers on which parts of the code need to be edited would be helpful. Or is it better to write some separate, independent code to do these other functions?



    After reading in the OSPi forum, I think I will try writing some separate code and interface to the OS firmware through the API with web calls to the localhost.

    Does this sound correct, or is there a better way to integrate other functionality of the BBB with the OS firmware?



    Support for mini-relay has been discontinued (in both hardware and software) since earlier this year. If you want to use a relay with OpenSprinkler you can wire a 24VAC relay just like a standard sprinkler valve (see the blog post below about available 24VAC relay options)

    The unified firmware is written in C++ to maintain maximal compatibility with the microcontroller-based OpenSprinkler. If you are familiar with C/C++ I think it’s not too difficult to go through the code and find out where to add additional code. For example, if you want to add an additional sensor, you can follow how rain sensor is implemented as an example. We should probably document this somewhere, but the source code is basically partitioned as follows:
    – defines.h: global macro defines, options, GPIO pin definitions
    – OpenSprinkler.h/.cpp: functions / data structures that are relevant to the basic / low-level operations, such as loading/saving options, station attributes, controller status variables
    – main.cpp: this is where the main loop is defined, which is in charge of scheduling of sprinkler stations, handling of log, time keeping and so on.
    – weather.h/.cpp: initiate weather queries and handling query results
    – program.h/.cpp: data structure for sprinkler programs.



    Sorry to dig up old thread.
    I also have an OSBo and would like to make use of the mini-relay.
    I have recently upgraded to Firmware 2.1.9(9).

    – were you able to get the mini-relay working? If so, what changes did you have to make?

    – I know you said the mini-relay has been discontinued, but it would be great if it was still useable for those that have it. Can you provide pointers on what changes we can make ourselves to use the mini-relay?



    I got a hint from another user @sakos on how this could be achieved in this post –

    – Control of relay on legacy Opensprinkler Pi boards.
    To assign the relay to a station just configure the station as “RF” and set “0” as RF code.

    I downloaded their SD card image to try to figure out what changes they made.
    They made changes to the function switch_rfstation in OpenSprinkler.cpp

    The function has slightly changed in the latest Firmware 2.1.9(9) from what sakos had. So I took what sakos did and tried to make it work.
    What I came up with is this:

    void OpenSprinkler::switch_rfstation(RFStationData *data, bool turnon) {
    ulong on, off;
    uint16_t length = parse_rfstation_code(data, &on, &off);
    #if defined(ARDUINO)
    #if defined(ESP8266)
    rfswitch.send(turnon ? on : off, 24);
    send_rfsignal(turnon ? on : off, length);
    if (((char*)data)[0]==’0′ && ((char*)data)[1]< ‘0’) {
    //Single zero character of RF code
    digitalWrite(PIN_RFTX, turnon ? HIGH : LOW);
    } else {
    // pre-open gpio file to minimize overhead
    rf_gpio_fd = gpio_fd_open(PIN_RFTX);
    send_rfsignal(turnon ? on : off, length);
    rf_gpio_fd = -1;


    … and it works in controlling the mini-relay!

    I understand the PIN used by the mini-relay has been repurposed in the code for the RF functionality.
    It would be great if @Ray could implement a way to choose if you are using the RF functionality or the mini-relay.
    Perhaps it could be handled with the argument to the script? something like:
    sudo ./ osbo_relay (for the relay)
    sudo ./ osbo_rf (for RF)

    But for now I guess I’ll have to live with my hack.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums Hardware Questions OpenSprinkler Beagle (OSBo) Unified Firmware and BBB IO