BACKGROUND & GENERATION OF AN IDEA //
If you work in a small office, perhaps you experience some of the same issues that we have. One of the frustrating things that occurs whenever I order a package is a delay between when it arrives at the office, and when I get it into my grabbers. For some reason, whenever someone answers the door to receive a package, they just place it on the shipping table but don't bother telling the person to which the package belongs.
So this was enough of a motivation for me to figure out how create a system to alert each individual in the office when they have a package available downstairs.
My answer to this problem was to create a dashboard with everybody's name on it and a bunch of buttons. When you pressed the button next to an employee's name, it would send them an email alerting them that they had a package available downstairs. The hope was that when people received packages from FedEx/UPS/USPS they would walk by the dashboard and could quickly notify all the owners of the packages and then get back to whatever they were doing before.
.........(1) Particle Photon - Wifi connected microcontroller
.........(2) Push buttons - Sparkfun
.........(3) PCB Protoboard - I used a solder board so everything was a bit more permanently mounted.
.........(4) Jumpers or Standard Wire
.........(5) 3D Printer (FDM)
.........(6) Colored LED(s)
..........(7) Various fastening hardware
..........(8) Label Maker
STEPS // A brief overview of the steps involved in producing this device and implementing it in your office
(1) Mechanical - This step will run through the physical components to this project
(2) Electrical - This covers the electronic components and wiring.
(3) Firmware - Here we talk about the code that runs on our microcontroller. These are the brains that know what to do when you mash all your coworkers buttons.
(4) Server Scripts - Once the dashboard determines that someone has received a package, it calls on another set of code located on a server to send our email to the eagerly awaiting employee.
(5) Optional - Software Interface - If you have coworkers like mine, as soon as you install this device, they will immediately start pushing button at random when they walk by because they find it funny. So I also wrote a software interface that can run on a Windows Tablet which essentially replaces the physical dashboard and captures a picture every time someone presses a button, to help sniff out pranksters. .
(6) Going further & Next Steps - A couple suggestions for things I haven't yet implemented, but may help your device work better.
Step 1: Mechanical
There are two main components to this step: (1) the mechanical side and (2) the electrical side.
The physical side of this project consists of a main panel holds all the buttons and name plates on the front and all the electronics on the back. This is essentially all that needs to be mounted to the wall and is what your coworkers will be interacting with.
1. Edit Solidworks File -- I created the main plate in Solidworks 2014 (see attached .Sldprt & STL files), so if you have access to this program, you can go in and edit it as you please. The text of each of the name plates should be pretty easy to edit, so you can go in and add your coworkers names, instead of mine. I actually didn't even end up using the name plates for my alpha prototype, and instead just used labels from our label maker. Strips of tape with sharpie will do the job just fine.
2. Print Base Plate -- I printed this on my company's Stratasys, which despite being a fairly nice machine, failed mid-print so it didn't come out exactly as I intended, but I was able to make due.
3. Add Threaded Inserts -- The base was designed to use threaded inserts to mount each of the name plates. You can find these on McMaster as well as button cap 6-32 screws to hold each plate.
4. Screw on Buttons -- I used push buttons from Sparkfun, but you can use most any button the is in a normal closed switch. This means that the circuit is broken when the button isn't pushed and completed when completed. The ones from Sparkfun should slide right in from the back and fasten with the nut from the front of the plate.
Step 2: Electrical
The next stage of the physical components is to wire up the circuits. With all the switches, there are lots of wires that are going to be floating around so make sure you lay things out and plan what your circuit is going to look like. I've included a diagram of the circuit with this step. I also used a prototype soldering board with pos/neg rails on the sides. This made it easier to combine all the junctions into long strips. In essence, we are using the Analog 0 pin to read the voltages that occur when different resistors are added into the circuit. When no buttons are pushed, we read the value created by our single resistor (I used a 10k ohm resistor), then when a button is pushed, we introduce a resistor in parallel to the existing resistor creating a new resistance and voltage. It doesn't really matter what resistors you pick for each button, you just want to make sure they are all unique and evenly spaced values. The greater distance between the resistors, the greater the triggering window can be in the firmware to capture any weird noise or variation in the signal when a particular button is pressed.
Step 3: Firmware
If you're not familiar with Particle's (formerly Spark) Photon Board, you're in for a treat. It is wicked easy to get started with and even easier to make changes to your firmware once you have everything wired up and mounted by the door. Because the Particle board's firmware can be flash via your wifi network, you don't actually need to be plugged directly into it like out microcontrollers. This means you can test out your code more easily while it is actually setup in your device and you can tweak and update the program from your desk if need be.
If you need to get familiarized with the Photon, I suggest you start here: https://www.particle.io/
They have a lot of great resources, but if you still have a lot to learn about microcontroller, you might find use in Arduino's website as well: https://www.arduino.cc/. They have all sorts of tips, tutorials and libraries that you can use.
I've included some images of the code above (and will hopefully have it posted on Github shortly), but I will walk through the general logic below if you'd like to try coding it up yourself (definitely the best way to learn).
CODE WALKTHROUGH //
#include "HttpClient/HttpClient.h" << This is a library that you can access through Particle that helps format and send HTTP requests. We will use this to access the PHP script running on our server.
void setup() << The setup function runs first and establishes all the things that we only need to do once. In this method we are going to (1) start our serial communication for debugging, (2) set up our analog read pin and (3) set up our LED indicator pin out.
void loop() << The loop function contains all of the recurring operations of the code. This is where we see if any buttons are currently being pushed. I've added in a 50ms delay between each cycle through this function to as to not unnecessarily burden the chip. I then take 10 readings from the analog pin and average these values. This gives us our read value.
<< From here, we determine whether this value matches our baseline value caused by the original resistor or a predetermined value that comes from completing the circuit with one of the buttons through a different resistor.
<< If it is determined that the value corresponds to a button the sendEmail() function is called.
void sendEmail(String recipient) << Here we contact the PHP script running and pass the name of the employee who's button has been pushed. Additionally, before the email is sent, I turn on the indicator LED to let the user know that the message was properly received, then it pauses so you can't send multiple messages at once. After the delay, the LED turns off again.
Step 4: Server Scripts
The final necessary piece to this project is server code that sends the emails written in PHP.
So my compna
Step 5: Optional - Software Interface
Very quickly after I installed the dashboard next to the door of my office, I found that people found it far more enjoyment in sending random emails to mess with their coworkers than to actually use the device properly. Since I was still in beta test phase of the device, looking at both usability and value as well as the robustness of the electronics and software, it was really frustrating to not be able to tell when it was malfunctioning and when someone was just messing with it.
So I had to devise a method for preventing people from pressing wrong buttons for fun. I thought about adding methods for tracking who pressed the buttons, like the first button you push is your own or you have to punch in a numeric code.