Care homes have been one of the worst affected by the COVID pandemic, with high levels of transmission. Care workers have had to adapt to the pandemic, with a more demanding workload, exacerbated by poor digital infrastructure. From tracking testing results to PPE stock, care homes struggle with collecting and managing data. In turn, growing concerns over the safety of transmissions across care homes, have heightened restrictions, leading to many missing out on meeting their loved ones. An all-in-one solution, which can help care workers to track vital data securely is necessary.
Introduction DeVolatusMeet Devolatus, the multi-functional smart IoT dashboard, helping to make care homes a safe space by improving digital infrastructure and logistics tracking.
The device allows care home workers to track capacity and sends reminders whenever capacity is reached. Moreover, the dashboard helps workers keep track of vital supplies (e.g. PPE), providing reminders when stocks are low. The system uses AWS IoT + Analytics and SNS to store all relevant data safely and securely and send notifications accordingly.
Section 1: Setting up AWS IoTStep 1: Create a new AWS IoT ThingSearch for AWS IoT Core from the AWS dashboard and select things under the manage tab.
Under the polices section, create a new policy. Make sure to label the action as iot:* and replace the Resource ARN with an asterix. These features will enable all actions.
Return to the things setup tab and attach the policy to the certificate. Download the certificate, public key and private key. Rename them to "certificate.pem.crt", "public.pem.key" and "private.pem.key"
Step 4: Set up a new cognito identity poolReturn to the AWS Dashboard and search for cognito. Create a new identity pool. Choose a unique name and enable access to unauthenticated identities. Under details, change the policy and replace it with the thing ARN (viewable if you return back to your AWS IoT core thing).
Download M5 burner software from https://shop.m5stack.com/pages/download
Choose the UIFLOW Core 2 firmware, and setup the wifi credentials, and burn.
Note: If the burn attempt times out, you may need to change the "com" port or replace your usb-c cable.
Under configuration, select start as internet mode and copy your API key.
Step 6: UIFlow Programming for AWS CommunicationVisit the digital IDE of UI Flow here: https://flow.m5stack.com/
Within the section, we want the core 2 to communicate with AWS and publish a message (using MQTT). Using the "AWS" blocks, make sure to use the name of your thing, and enter your host name as the device data endpoint. This can be found under the settings tab on the main AWS IoT page. Ensure
aws = AWS(things_name='enterthingname', host='enterhostnamehere', port=8833, keepalive=60, cert_file_path="/flash/res/certificate.pem.crt", private_key_path="/flash/res/private.pem.key")
aws.start()
while True:
aws.publish(str('exampletopic'),str((json.dumps(({'firstvalue':'20','secondvalue':'21'})))))
wait(4)
wait_ms(2)
(Alternatively using micropython)
Step 7: MQTT Testing + TroubleshootingUnder the test section of the IoT page, enter the MQTT test client and subscribe to your topic name e.g exampletopic After running the code on your device, the values should be viewable on the client.
If you do not see any topics, there are a range of different possible issues which may be causing an error. First of all, make sure the connection between the device and AWS is occurring- this can be found under the "monitor" section of the AWS IoT dashboard. Also try subscribing to the wildcard MQTT topic, by entering a pound sign "#"
1. Check to see if the AWS location on your endpoint and the MQTT client match (If they don't, then you need to repeat the steps in the correct AWS location).
2. Issue with desktop IDE of UIFlow- there may be issues with the desktop IDE when communicating to AWS. This may cause an error on the device (e.g. "cannot create thread"). Switch to the digital IDE instead.
3. Policy issue- double check the policy is correct, and ensure it is attached to the certificate and thing properly.
4. Check to see if the certificate is active (under the secure section of the AWS IoT section). You should also be able to check it is linked to the policy and thing. If it is not active, you should be able to activate it using the toggle menu.
5. Check your certificate and key is added to your device properly. Sometimes if the device is not reachable when downloading, they may disappear from the initial upload. The root CA certificate is hardcoded in the device, but it may be worth also flashing it onto the M5 Stack (this was a solution that fixed my own connectivity issues). Find it here: https://www.amazontrust.com/repository/AmazonRootCA1.pem
Right click and save as a ".pem" file and add it to flash (file manager on UIFlow to the certificate section).
6. Check the certificate using OpenSSL. Details can be found here: https://docs.aws.amazon.com/iot/latest/developerguide/diagnosing-connectivity-issues.html
Section 3: User interface design with FigmaNow we have setup the basics for AWS, the next step is to work on the design of the device. To do this, we can leverage figma to prototype our UI design.
Step 8: Creating UI Template + Colour PaletteCreate a new figma design file and create a new frame with the dimensions of the M5 Stack Core 2 screen (320 x 240). Use montserrat for font (default for UI Flow) and experiment to find good colour themes.
After working out the basic design, it's time to start building up your design and consider all the interactions
It's vital to consider design thinking at a consumer level- in our case we want to make our process easy, intuitive and quick to avoid long lines and alienating visitors/staff.
- Empathize: Contextual research and understanding consumer needs
- Define: Project constraints and problem analysis
- Ideate: Solution brainstorming and implementation
- Prototype: Figma UX Mockup
- Test: Consumer testing
Using the inspect tab, you can copy the properties of the buttons to the UI Flow Prototype.
The code is available on the GitHub (see code section). The capacity counting algorithm for visitors is quite simple.
The capacity counter simply publishes the local variable to AWS (using MQTT). If an attempt is made to sign out when the capacity is already 0, a error will be thrown to the user. If the capacity has reached then an email will be sent (via SNS).
def Sign_Out_Visitor_pressed():
global Capacity
if Capacity > 0:
Capacity = (Capacity if isinstance(Capacity, Number) else 0) + -1
aws.publish(str('capacity'),str((json.dumps(({'capacity':Capacity})))))
wait(1.5)
rgb.setColorAll(0x33ffff)
speaker.playWAV("res/success.wav")
CloseVisitorSign()
OpenHome()
else:
Error_Registration.set_hidden(False)
wait(3)
Error_Registration.set_hidden(True)
pass
Sign_Out_Visitor.pressed(Sign_Out_Visitor_pressed)
def Visitor_Button_Home_pressed():
global Capacity
CloseHome()
wait(2)
OpenVisitorSign()
pass
Visitor_Button_Home.pressed(Visitor_Button_Home_pressed)
Step 12: Create SNS topic + subscriptionNavigate in a new tab to the SNS service, and create a new topic called "capacity", and setup the email protocol. You need to accept the confirmation sent to the target email
After creating the SNS topic head back to the IoT page
Step 13: Create an IoT rule for sending SNS MessagesYou need to create a new rule for sending SNS alerts via email, if the capacity reaches the limit. Navigate to the rules section (under "Act" in AWS IoT dashboard). Create a unique name and add the following SQL Rule Query Statement:
SELECT capacity as capacitycount, 5 as max_capacity FROM 'capacity' WHERE capacity > 5
Setup the action to send an SNS push notification- linked to the capacity topic.
You should receive a similar email whenever the condition is met:
Repeat the same processes above, except this time for the stock inventory counting section. Remember to create a new SNS topic.
Replace the SQL for the rule sections with this:
SELECT masks as maskcount, 5 as min_capacity FROM 'masks' WHERE amount < 5
The code for adding stock is similar, except we are also sending the employee :
def add_mask_pressed():
global maskboxes, employee
maskboxes = (maskboxes if isinstance(maskboxes, Number) else 0) + 1
aws.publish(str('masks'),str((json.dumps(({'Employee':employee,'Amount':maskboxes})))))
medicine_amount.set_text(str((str('Amount:') + str(maskboxes))))
pass
add_mask.pressed(add_mask_pressed)
Demo:
Section 5: Chassis Design + 3D PrintingThe final stage is to 3d print the chassis design for DeVolatus.
Step 14: Import STL files into slicing software and export to GCODE and Print
Comments