Inspiration

The problem(s): Municipalities have no way of communicating with people if the internet or cell networks or power went down in an emergency. In peace time, not everyone has internet access or a data plan on their cell phones. GPS drains batteries and the internet is a big place to find local information.

What it does

The solution: Safety Net! An independent, local, self-healing, wireless mesh communication network! Safety Net nodes are deployed throughout the city. Each low cost, small form factor node has a Bluetooth radio and a sub-Ghz radio. Municipalities can inject text messages into the network and they are distributed to all the nodes via mesh networking over the long range sub-Ghz radio. Each node broadcasts the messages via Bluetooth with no connection required. Both radios are very low power so they can be powered with a solar panel and a battery. Works even when the power is out! Allows municipalities to communicate messages to anyone with a cell phone or smart device with Bluetooth. Wearable BLE technology enables access for users with different needs. No data plan or wifi required! Nodes report their health back over the network referencing their location. Real time analytics and network health information visualized via Scriptr and the Pitney Bowes Geo APIs. Endless applications: Emergency notifications, weather reports, traffic updates, train and bus schedules and changes, current location of trains and buses, city events, parking information, traffic sign notfifications, hyper local targeted messages…

How we built it

The demo! Raspberry Pis with BLE USB dongles and EnOcean USB dongles driven by python. (EnOcean is a proprietary sub-GHz low power, long range network. Any low power, long range wireless protocol could be used.) A python script running on a laptop sends text messages out over the sub-GHz network periodically, simulating a municipality’s master gateway. Each Safety Net node receives the message via the sub-GHz network. The nodes then echo the message over sub-Ghz to pass it on to other nodes out of range of the original broadcast. The nodes also update their BLE advertisements to contain the new message. Any cell phone or smart device with BLE can be used to view the messages. They change every 5 seconds. We recommend nRF Connect. The master gateway monitors the health of each node and sends reports containing the node coordinates and health to Scriptr. Scriptr uses the coordinates to lookup locality information via the Pitney Bowes Geo API. This information is overlaid on a map using Scriptr and the Google Maps API (could use Pitney Bowes API with more time!).

# This code snippet sends an update to Scriptr using curl.
# It also sends out a sub-Ghz message every 5 seconds. 
# This part simulated the Safety Net gateway. 
class TestApp(object):
    testResults = ""

    def Test(self, comportENOCEAN, msg, debug):
        self.debug = debug
        self.enocean = EnOcean(comportENOCEAN, debug)
        heartbeat = 0

        cmds = ["curl -X POST -F node=NHPD -F id=E9-BF-68-6F-53-A5 -F lat=41.299810 -F long=-72.925356 -H 'Authorization: bearer VzE0NzE0QjhEMDpzY3JpcHRyOkE5QkQ5M0I1OTA1QzlFNDNEMkI3NDNCOkMwMDI2' 'https://api.scriptrapps.io/geoservices/scripts/devices'", "curl -X POST  -F node=MakeHaven -F id=D0-7F-89-6F-51-4D -F lat=41.303861 -F long=-72.923722 -H 'Authorization: bearer VzE0NzE0QjhEMDpzY3JpcHRyOkE5QkQ5M0I1OTA1QzlFNDNEMkI3NDNGRkMwMDI2' 'https://api.scriptrapps.io/geoservices/scripts/devices'", "curl -X POST  -F node=\"Union Station\" -F id=76-7F-A9-25-81-BE -F lat=41.297391 -F long=-72.926746 -H 'Authorization: bearer VzE0NzE0QjhEMDpzY3JpcHRyOkE5QkQ5M0I1OTA1QzlFNDNEMkICOENGRkMwMDI2' 'https://api.scriptrapps.io/geoservices/scripts/devices'"] 

        for cmd in cmds:
            call(cmd, shell=True)
        cmd = 0 
        if (msg == ""):
            msgs = ["Hackers in New Haven!", 
            "RtD bus @ 372 Dixwell Ave", 
            "Traffic Jam I91 Exit 1", 
            "Zombie apocalype upon us", 
            "B R A A A I N S", 
            "IntlFestvlArts&Ideas6-10", 
            "Puppies are Cute", 
            "Blizzard wrning til 12PM"]
            while True:
                for i in range(len(msgs)):
                    print "Sending message : {:s}".format(msgs[i])
                    self.enocean.sendTextPacket(msgs[i])
                    heartbeat += 1
                    if (heartbeat == 6):
                        heartbeat = 0
                        call(cmds[cmd], shell=True)
                        cmd += 1
                        if (cmd == len(cmds)):
                            cmd = 0
                    time.sleep(5.0)
        else:
            self.enocean.sendTextPacket(msg)
# This code snippet shows the python script running on the Raspberry Pi.
# It consists of a forever while loop checking for messages coming
# in from the sub-Ghz radio USB dongle.
# Once a message is received (sometimes in pieces),
# it is sent out as the new BLE advertisement which
# continually sends until the next update over the BLE radio USB dongle.
def geteno():
    msgs = checkForMessages('/dev/ttyUSB0',1)

    if len(msgs) != 0:
        entire = ''
        for i in msgs:
            entire += i
        if not config.ble:
            bgl.bleSetup()
        bgl.bleSend(toHex(entire)[:25],False) # send as node
        bgl.disconnect()
    else:
        pass

while True:
    geteno()

Challenges we ran into

Raspberry pi booting and images! Time!

Accomplishments that we're proud of

It all works! EnOcean message to BLE advertisements. Stats upload through Script and using Pitney Bowes Geo API!

What we learned

Bash commands, python commands, raspberry pi debug, online APIs...

What's next for Safety Net

What’s next? Choose final wireless protocol for long range mesh. Design custom cost reduced, low power hardware with solar panels and batteries. Develop software suite to control and visualize the network using Scriptr and the Pitney Bowes Geo APIs. Develop mobile App. Integrate with digital signage. Integrate existing municipal APIs as a source of messages. Save the world!

Built With

Share this project:
×