Introduction: Waiter Please Bot
What can goes wrong with a waiter call bell punching by a servo in an open office space?
- I don't know :D
People tend to hate alarm or even interruptions, so may it is a good idea to make it a little bit funny (for a while at least). That is what I aimed to achieve. Quickly alert engineers about critical incidents in an acceptable way.
It is my first Arduino project made from Ethernet shield, Infra red control, SG90 9g Micro Servo and recycled materials.
The slapping action triggered via WebHook or remote control. The remote control also used for fine to the angle of the arm.
Step 1: How It Works?
It listen on infrared receiver and fetch an HTTP address for a given keyword. Infrared controller can use for fine tuning of the angle of arm and can use for trigger as well. The HTTP Response can use only for triggering the bell. ( In current case I made a small web application what catch webhook from Slack and manage a flag. - Not included in this instructable )
Basically I used infrared controller only for debugging purpose. 1st time I made a mistake by let the controller stay next to slap machine, but folks were curious enough to triggering slap many times so I find the device disconnected :)
In real life it just periodically check a hard-coded web address what has similar response like: http://httpbin.org/get?anyslap=1
If the anyslap keyword followed by an integer than it makes as many arm movement.
Step 2: Component Required
Electronic components:
- Arduino Uno R3
- UNO Shield Ethernet Shield W5100 R3
- Infrared IR Wireless Remote-Control Module Kit
- Servo (SG90)
- Universal Printed Circuit Board 4x6cm
- 5 x LED
- 5 x 220 Ohm Resistor
- 30AWG Silicone Wire
Recycled materials:
- Shampoo flacon
- Carton boxes
- Toy hand (come with a buy two croissant get one hand for free :)
Step 3: Combine the Arduino Tutorials
Mostly I just followed Arduino Built-In Examples, Library Examples and combined to one project.
Recommended lessons
- Blink Without Delay - Used for LED indicators; millis() function to check HTTP periodically and turn off servo if not used.
- ASCIITable serial output functions - Used for debugging.
- Control Structures, like: Loop Iteration, Switch Case, If Statement, While Loop
- Ethernet Web Client with DHCP Lease - Used for receiving triggers from HTTP endpoint.
- Servo Lesson - used for the arm movement (rotation).
- Infrared Receiver - used for additional control and fine tune the angle of the arm.
Step 4: Search for a Keyword in HTTP Response and Other EthernetClient Issues
The assembly of the Waiter Please Bot was pretty much straight forward except the Ethernet things.
Difficulties:
- Any EthernetClient call especially DHCP Lease are single process. It works like a delay with rand what pauses the program.
- Forget about JSON in API and WebHook Arduino Strings are evil anyway.
1. - Single process.
I give up to make the program does multi processes. I google few possible solution but non of them were simple. I wanted to keep the code as small and easy to read as possible.
2. - Parse HTTP Response.
The stability and able to work without maintenance are key requirements. So I avoid to use any String object due to possible memory leaking.
EthernetClient is rely on Stream base class and its find function make possible to search keyword. It is a bit complicated and occupy many lines of code, but it works.
Step 5: Sketch and Source
Repository: https://github.com/olivernadj/waiter_please_bot/
Step 6: Build the Hardware
- There are four corner guards within the shipped box of Macbook. I used it as a stand.
- Cut out a small shape fit for the servo.
- Glue together the stand and the servo with hot melt glue gun.
- Took a pipe from a used shampoo flacon and screwed to the servo.
- Pull the toy hand on the pipe.
The Controller
- Made a prototype on breadboard.
- Copy the breadboard prototype to the universal printed circuit board.
- I used break away headers for all wire circuit connection.
- Cut out the paper box.
- Glue together the front of the box and the printed circuit board.
- Put the Arduino board, Ethernet shield and some sponge to the box.
Done.