The country house alarm system

Project Description

Introduction

The wireless (GSM) home security alarms have two main drawbacks:
  1. The system requires the timely battery replacement.
  2. The wireless signal can be jammed.
I decided to use the wired security alarm in my home, which can send the alarm signal to my mobile phone. This alarm does not have these drawbacks because it uses the Ethernet cable connection to the modem instead of WiFi. The alarm sensors have wired connections too.The W5100S-EVB-Pico board from WIZnet is the ideal solution for the security alarm, which can send the data using Internet. This board has the Raspberry Pi RP2040 microcontroller and the controller W5100S for Ethernet:W5100S-EVB-Pico description W5100S-EVB-Pico descriptionFrom the picture above, you can see enough GPIO pins for the external peripheral devices and sensors.Additionally, the board is well documented on WIZnet website: https://docs.wiznet.io/Product/iEthernet/W5100S/w5100s-evb-pico and has many project examples. This allows the user to quickly start with this board.I used only two GPIO pins in my project to read data from motion and door sensors:System schematics System schematicsThe security alarm is very simple. W5100S-EVB-Pico reads data from sensors and send it to the MQTT broker on the Amazon AWS cloud. The application on the mobile phone can read these data, subscribing to the corresponding topic on the Amazon MQTT broker.

The hardware

The hardware is very simple, and it is based on the W5100S-EVB-Pico board. The figure below describes the hardware in details:Hardware description Hardware descriptionAs you see above, the hardware does not require any additional electronics components. The alarm sensors outputs connect to GP14 and GP15 pins of the W5100S-EVB-Pico board. The firmware configures the internal pull-up resistors in RP2040 for the GP14 and GP15 pins:Pull-up resistors Pull-up resistorsSo we do not need the external resistors for our sensors.

Amazon AWS services

Before using this project, you should have the Amazon AWS account and create the resources in AWS IoT. The WIZnet website has the good manual for this: Getting Started with AWS IoT Core.

Firmware

The firmware is simple. It is based on the sample project aws_iot_mqtt which is available on the WIZnet website:https://github.com/Wiznet/RP2040-HAT-AWS-C/tree/main/examples/aws_iot_mqttThe modified firmware is attached in the DOCUMENTS files section below.

How to use the attached firmware

The firmware configures GPIO pins for sensors, the network and DHCP protocol, setups the certificate, initializes the MQTT transport. Then it makes the connection to the MQTT broker and subscribes to the MQTT topic.After that, the code in while() loop reads the sensors and publish sensors data to the MQTT topic on the AWS cloud. Additionally, I have configured the LED on the W5100S-EVB-Pico board to blink. This LED is also useful for debug purposes.Note, you should replace the root certificate, client certificate and private key in the mqtt_certificate.h file. You should have them when you created resources in AWS IoT. Also modify MQTT_DOMAIN, MQTT_PUB_TOPIC, MQTT_SUB_TOPIC and MQTT_CLIENT_ID.

Mobile application

The Mobile application connects to the AWS cloud and subscribes to the topic on the MQTT broker, where data from alarm sensors is available. It shows the status of each sensor. The Android Studio project is attached.Mobile phone application Mobile phone applicationIt is based on the Android Studio project from there: https://github.com/felipemeriga/aws-sdk-android-samples. I used the AndroidPubSub project and modified it for my purposes. You need to download Android Studio to modify this project.
documents
Code
AndroidPubSub_v1_0
The Android Studion project for the Mobile phone application
AWS_IOT_MQTT example
Modiified AWS_IOT_MQTT example
Schematics
Basic Schematics
Used the existing W5100S-EVB-Pico with the external sensots
System Schematics
System Schematics
Hardware
Hardware description
Pull-up resistors
Pull-up resistors in the RP2040
Others
W5100S-EVB-Pico
W5100S-EVB-Pico description
Mobile phone application
The mobile phone application printscreen

1
COMMENTS

Please Login to comment
1 Comment authors
ronpang Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
ronpang
Member

Hi matvs,
I’m Ron from WIZnet HK. Could I post your article to our WIZnet HK instagram account?

BTW, do you have a instagram account that I could tag you?

Best Regards,
Ron

POSTED BY
W5100S Series Library
Reusable S/W