By the year 200X, the Mega Man series predicted that humans and robots would be living side-by-side, in a (mostly!) symbiotic relationship. But in 2020, we find ourselves in a very different reality - one where there aren't really many domestic or civil service robots - and thanks to the pandemic, even humans aren't living side-by-side for the most part. Inspired by the Mega Man series' legendary robotics engineer Dr Light, I approached this challenge with the goal of building a simple robot that could help society in some small way. This robot is One-Way Willie: a cute little bot who helps enforce one-way aisles in retail stores, limiting customer-to-customer interaction and reducing virus transmission! 🦠📉Getting Started 🔰 👩💻
The Arduino family of products helps make hardware prototyping quick and easy. Despite never having used an MKR WiFi 1010 before, I knew that the prototyping experience would be similar to every other Arduino I've used in the past, with perhaps a few different features and pin assignments. After running the traditional
Blink sketch to ensure everything was working, I began the process of exploring the functionality and support for the three components that my project would be using:
- 0.95" 96x64 color OLED
- piezo buzzer
- Pololu Carrier with Sharp GP2Y0A60SZLF Analog Distance Sensor 10-150cm, 5V
The IR distance sensor was the most critical part of my project, so I explored that first - and since its output is a simple analog value, it was as easy as connecting ground, 5V, and an analog input (see pinout above - I chose
A0). Instead of intense calibration, I just selected ranges and defined them as
The piezo was easier still: just a ground and PWM pin required (I chose
D5) to output whatever frequency of annoying buzz I choose (annoyingness is a desirable feature for this project...read on!).
The OLED was the most complicated connection, but made easier by a great project that I found on the Hackster-powered Arduino Project Hub, which pointed out the incorrect pin labeling on the PCB and how to leverage the Adafruit SSD1331 OLED driver library to create primitive graphics quickly and easily.
With the major components sorted, it's time to write some code! 🧑💻🧮Development Process 💪 💻
This was one of those projects that makes you feel masterful: you know from the start exactly what needs to be done, how to do it, and the code just flows with nary a bug to derail your developmental delight.
The first step was to leverage the above-mentioned proximity states to generate the desired output. When a customer is
FAR from One-Way Willy (hereout: "OWW"), there is no cause for (literal) alarm. But as our shopper becomes
NEAREST, OWW responds with escalating measures of dissuasion. This is achieved via a
drawFace() method, which outputs approximations of the 😮, 😟 and 😠 emojis with each further encroachment. Additionally, the
tone() method is used to emit a frequency corresponding to the proximity, and a duration relative to its square.
The last step was to ensure that only approaching customers, at risk of flouting one-way restrictions, feel OWW's wrath - those passing in the other direction should not be subject to painful alarm sounds and looks of disdain! By adding an additional
BEHIND state, when the IR sensor reads below its 10cm minimum, and a
priorProximity variable to keep track of whether an individual is moving toward or away from OWW, we can prevent the annoying buzzer and faces of disapproval (which would be to the person's back anyway), and instead offer a
DO NOT ENTER message for any approaching customers who may be considering violating the one-way policy while the sensor is currently occupied with our retreating rule-follower.
To ensure everything is working as expected, we test our conglomeration of sensors and code with a simple prototype case:Results and Conclusions ⚗️ 📊
The Arduino ecosystem and the community's many open-source libraries make it easy to prototype solutions to all kinds of problems, including those highlighted by this pandemic-themed contest. The MKR WiFi 1010 is a powerful, compact board, loaded with conveniences for prototyping and production - for example, moving off of USB power for development was as simple as connecting a LiPo cell using its standard 2-pin JST PH-type connector! 🔌🔋Next Steps/Future Enhancements 🔜 🔮
The current One-Way Willie is a simple, yet effective, prototype. If I were to win a Newark hardware voucher, the assistance of Dragon Innovation, and product marketing on Hackster.io, I would be able to develop it into a full, human-scale product, as well as considerably enhance the detection and discouragement techniques employed. 🙏💵
Additionally, the MKR's onboard Wi-Fi capabilities will allow me to incorporate MQTT via AWS IoT Core, as I have in other projects, enabling Willies to send analytics data to the cloud, as well as perhaps even coordinating responses to violators!!! 💡🤯