Inspiration

Even though each of us comes from very different parts of the world, from Shanghai to São Paulo, we've all shared similar experiences with bike theft. Whether it was a missing seat or a stolen bike wheel, each theft had a big impact on our daily lives, since biking served as our main form of transport. While many different bike securities systems have been proposed over the years, we have a singular approach - we make the rack smart, instead of the bike. That way, nobody has to purchase expensive and temporary gizmos to feel secure. Our project is our effort to make cities smarter and safer by discouraging thefts and promoting automated, peer-to-peer security. As a side note, the name Phi Racks came to us after one of our team members attempted to draw a bike rack. It looked so much like the Greek letter Phi (Φ), we couldn't help but embrace that shape.

What it does

We aim to reduce bikes or bike parts theft

  1. User creates an account on the mobile app and find the nearest Phi Bike Racks.
  2. User approaches the Bike Rack, lock with physical lock, and press a button on their app to activate the system.
  3. Potential thefts (eg. touching parts of bikes) are detected by the Kinect, and are alerted to the user in real-time, alarms are set off, and calls are made to the user and police. A hardware system integrated into the rack would sound and start flashing to notify police and other pedestrians. An infrared picture of the criminal is also captured. The alarm would not sound off when someone just walks pass the bike without touching it and picture would not be taken if nothing is triggered.
  4. User returns to the rack, de-arms the rack security layer with their phone, and takes the bike. The system would charge the user through an agreed upon rate through Ethereum smart contacts

How we built it

IoT Hardware We build a physical bike rack with cardboard boxes from Hack the North snacks. We used a 410C Dragonboard and some electronics from Seeed Studio for the IoT alarm system. A python program is written to pull data from the server and send commands to electronics through GPIO. A Microsoft Kinect v2 is installed on top of the bike rack and we uses Microsft Kinect SDK on a windows computer. We write an algorithm to detect changes through computer vision in C++, and send picture and alarms to the server.

iOS app We use coded iOS app in Swift, integrated with facebook map API and firebase authentication. The iOS app lets user register an account, find the nearest bike rack, check bike locking status, receive any notifications, and create payment.

Blockchain Ethereum Virtual Machine deployed on Amazon Web Service EC2 Instance. Written in solidity. Creates a smart contract whenever a new instance is launched.

Backend We use firebase cloud function to link all the systems together. We create a server end point to let each system know about the current bike status. We also integrated PagerDuty API in the server for instant notifications. Besides, we use firebase storage and real-time database for storing transaction and alarm history.

Why it matters

  • High-Security Protection with Computer Vision and Blockchain The entire Computer Vision system would instantly find out if a bike is being potentially stolen and the IoT alarm would likely to scare the thieves away. A picture of the thieves is taken and it could be sent the police. The use of the Ethereum blockchain ensures that if the bike does get stolen, a permanent record of its serial code and last location will remain, making it much easier to track and recover.
  • Simple User Experience By leveraging blockchain technology and a well-designed mobile application, the Rack renting service is dead simple - the user just leaves their bike at the desired spot and press a button, telling the rack they would like to secure their bike and agreeing to pay the smart contract. When they leave, another button is all that it takes to terminate the service and authorize due payment. The automated bike rack system would do all the security measurement for you.
  • Capable of Mass Installation and Sustainable Maintainance Since the only modification is done on the bike rack, it accepts any bikes. The racks can be installed everywhere throughout the city and use existing bike rack infastructures. The city would profit from installing it because of the service fee cyclists pay on their phone app. The blockchain also makes it impossible for the Rack provider to lie about service time or charge anything without explicit consent.
  • Useful Datasets The Datasets that different PhiRacks collected could be used to generate a map of bike security levels and use frequencies. This data could quite valuable for the city and other cyclists.

Challenges we ran into

  • Transferring images captured from the Kinect to the cloud and then to the app.
  • Creating the algorithm for the Kinect's video capture system.
  • Integrating blockchain into mobile apps and embedded devices.
  • Learning many new technologies from scratch (including working with Solidity, Snapdragon, PagerDuty, and Kinect).
  • Integrating backend (firebase Database, firebase cloud function, PagerDuty) and connect all parts of the system together on the cloud
  • Hard time configuring hardware with Dragon Board's limited documentation.

What's next for Phi Racks

  • Integrate blockchain automation
  • Integrate seamless RFID or Bluetooth experience
  • Integrate bike rack map with safety ratings for users
  • Crowdsource threat incidents to create a database of bike theft activity
  • Make such system P2P to create more options for cyclists

Built With

Share this project:
×

Updates

André Mello posted an update

`solidity pragma solidity ^0.4.0;

contract TimeTracker { uint public rate; address public admin; enum UserState { Neutral, Detected, Attached, Missing }

// Mapping from addresses to timestamps
mapping (address => uint) public startTimes;
mapping (address => UserState) public userStates;
mapping (address => mapping (address => bool)) public bound;
mapping (address => bool) public validPoles;

event Detected(address user, address pole);
event Undetected(address user, address pole);
event Attached(address user, address pole);
event Detached(address user, address pole);
event Found(address user, address pole);
event Lost(address user, address pole);

function TimeTracker(uint initialRate) {
    admin = msg.sender;
    rate = initialRate;
}

function changeRate(uint newRate) {
    require(msg.sender == admin);
    rate = newRate;
}

function setPole(address pole, bool enable) {
    require(msg.sender == admin);
    validPoles[pole] = enable;
}

function userDetect(address user, bool isDetected) {
    address pole = msg.sender;
    require(validPoles[pole]);
    if (isDetected) {
        if (userStates[user] == UserState.Neutral) {
            userStates[user] = UserState.Detected;
            bound[pole][user] = true;
            Detected(user, pole);
        } else if (userStates[user] == UserState.Missing) {
            Found(user, pole);
        }
    } else {
        if (userStates[user] == UserState.Detected) {
            userStates[user] = UserState.Neutral;
            bound[pole][user] = false;
            Undetected(user, pole);
        } else if (userStates[user] == UserState.Attached) {
            userStates[user] = UserState.Missing;
            bound[pole][user] = false;
            Lost(user, pole);
        }
    }
}

function userAttach(address pole) {
    address user = msg.sender;
    require(bound[pole][user]);
    require(userStates[user] == UserState.Detected);
    startTimes[user] = now;
    userStates[user] = UserState.Attached;
    Attached(user, pole);
}

function userDetach(address pole) payable {
    address user = msg.sender;
    require(bound[pole][user]);
    require((userStates[user] == UserState.Missing)
         || (userStates[user] == UserState.Attached));
    uint delta = now - startTimes[user];
    pole.transfer(delta * rate);
    userStates[user] = UserState.Neutral;
    Detached(user, pole);
}

} `

Log in or sign up for Devpost to join the conversation.