1

Device and Firmware

  • Raspberry Pi - 2 and Debian Wheezy 7.10/7.11

I have a config.json or config.ini file which I send to the Pi in the form of a compressed file with other files (in .tar)

At the Pi I would have a triggering mechanism (using inotify-tools) which when receives the compressed file, untars it and then runs a python script to parse through the information.

config File

{
"pins":{

    "20": 1,
    "21":0
 },

 "files":{

      "Pi-1": "file1",
      "Pi-2": "file2"
   }
}

The keys in the above mentioned config.json file mention the following:

  • GPIO Pin 20 must be High

  • GPIO Pin 21 must be Low

Is this possible to set via the rpi.gpio feature for Python or are there some ready made implementations that some one has in mind or uses with Pis?

Scenario

I am using a Multicasting scenario where I want to send files to many Pis within an ad-hoc network. This is needed since I cannot ssh into each Pi and send files and set the GPIOs individually since this will consume a lot of time (I am expecting at least 50 Pis). SSH is TCP based and hence broadcasting/ multicasting a bunch of files is not possible in general, hence I shifted my focus on UDP and there is something called as Fountain Codes which is an FEC based technique to distribute data(files) within a network. There are a lot of other reasons why I do not use TCP which are beyond the point of this question.

I have an implementation ready for the above mentioned FEC technique where I take one file and distribute it all the Pis that are a part of the Multicast group. As mentioned before I need to configure some GPIO pins on Pis. This configuration varies from Pi to Pi hence a configuration file is needed to specify which Pi will have which settings and which file for further operation.

Reasons for a tar file

it consists of :

  • a config file

  • numerous files for different Pis (which file belongs to which Pi is mentioned in config file)

Hence I compress the whole Pack into a tar and then untar it at the Pis.

1
  • will update my question for better clarity of the situation
    – Shan-Desai
    Commented Jul 19, 2016 at 12:08

2 Answers 2

3

You might want to look into Chef (chef.io), and Puppet (https://puppet.com/) both of which provide the tools and services to allow deployment of particular configuration to multiple clients. I doubt that either would have (today) a recipe for configuring the GPIO pins, that would likely be something you'd have to add.

0

Yes, you can write a program to do this.

I'm not aware of any existing programs which do what you want, possibly because it seems an odd way to go about doing things.

5
  • Well think of the scenario as many Pis and each Pi receiving this file but maybe with different GPIO pins values. Logging into each Pi and setting this up would be quite tedious hence just to automate the whole bunch I though of a config file.
    – Shan-Desai
    Commented Jul 19, 2016 at 11:11
  • 1
    Using json doesn't seem odd although expecting that there is pre-existing software to process a configuration scheme you dreamed up seems odd to the point of absurdity. As joan says, obviously yes you could write a program to process the protocol you have invented, and there is also obviously a very large spectrum of other equally reasonable ways to do this.
    – goldilocks
    Commented Jul 19, 2016 at 11:50
  • 2
    Yes, you are both right, I'm just a bit set in my ways. A simple piece of Python could consume the JSON, e.g. import json; f = open(FILE, "r"); records = json.load(f); f.close();. The rest you could implement in a few lines of code. Probably a half hour job to write and test.
    – joan
    Commented Jul 19, 2016 at 12:08
  • You might want to look into Chef (chef.io). Which provides the tools and services to allow deployment of particular configuration to multiple clients. I doubt that it would have (today) a recipe for configuring the GPIO pins, that would likely be something you'd have to add. Commented Jul 19, 2016 at 16:12
  • @KenHughes You could make that an answer.
    – joan
    Commented Jul 19, 2016 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.