Brello Fob (umbrella share)
Made by Matthew M, Qin Bian, kanikak, Dani Quan, Benjamin Hecht and nsridhar
Created: April 28th, 2018
SUMMARY
Brello is a local umbrella sharing system similar to Citibike.
As part of this system, users can unlock an umbrella with a keychain FOB at a Brello location.
The FOB also indicates whether umbrellas are left at the stand so that users do not walk to a Brello stand only to realize none are left.
Brello Main Project Explanation: http://ideate.xsead.cmu.edu/gallery/projects/brello
HOW IT WORKS / COMPONENTS
The FOB has a map of the CMU campus as well as LED's indicated whether umbrellas are left at the location - red means none left, green means some available.
A RFID tag on the FOB interacts with a RFID scanner that unlocks a Brello and sense when the user has returned it after use.
//COMMUNICATING VARIABLES
// This value will store the last time we published an event
long lastPublishedAt = 0;
// this is the time delay before we should publish a new event
// from this device
int publishAfter = 10000;
int location1 = D4;
int location2 = D6;
String color = "";
void setup()
{
Particle.function("flashToggle1", flashToggle);
Particle.variable("colorStatus",color);
Particle.function("lostBrello", lostBrello);
Serial.println("hi");
// vibrator actions
pinMode( location1, OUTPUT );
digitalWrite( location1, LOW);
pinMode( location2, OUTPUT );
digitalWrite( location2, LOW);
// button actions
Particle.subscribe( "diot/2018/brello/umbrella_status" , handleSharedEvent);
}
void loop()
{
}
int flashToggle(String command) {
Particle.publish("diot/2018/brello/umbrella_status", command);
return 1;
}
int lostBrello(String command) {
Particle.publish("diot/2018/paired/");
return 1;
}
// Our event handlde requires two bits of information
// This gives us:
// A character array that consists of the event name
// A character array that contains the data published in the event we're responding to.
void handleSharedEvent(const char *event, const char *data)
{
Serial.println("handle event");
String umbrella_status = String( event );
String update = String( data ); // convert to a string object
updateStatus(update);
}
void updateStatus(const char* getData) {
Serial.println(getData);
if ((String)getData == "returned") {
digitalWrite( location1, LOW);
digitalWrite( location2, HIGH);
Serial.println("RETURNNNNNNED");
color = "green";
}
else if ((String)getData == "taken") {
digitalWrite( location1, HIGH);
digitalWrite( location2, LOW);
color = "red";
}
}
// FUNCTION THAT takes info from rfid scanner and turns
//LED green or blue
// update variable that controls rgb values
Click to Expand
A hands-on introductory course exploring the Internet of Things and connected product experiences.
~