Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Ensar Karabudak
Published © GPL3+

Battery-Powered Silo & Level Measurer: Pico LTE and AWS IoT

This project aims to create a battery-powered IoT Silo & Level Meter that measures and sends real-time data to AWS IoT

IntermediateFull instructions provided3 hours1,428
Battery-Powered Silo & Level Measurer: Pico LTE and AWS IoT

Things used in this project

Hardware components

Sixfab Pico LTE
Sixfab Pico LTE
×1
Ultrasonic Sensor - HC-SR04
SparkFun Ultrasonic Sensor - HC-SR04
×2
Waveshare UPS Module for Raspberry Pi Pico
×1

Software apps and online services

MicroPython
MicroPython
AWS IoT
Amazon Web Services AWS IoT

Story

Read more

Code

Send distance data to AWS with Pico LTE

MicroPython
import json
from hcsr04 import HCSR04
from pico_lte.core import PicoLTE
from pico_lte.common import debug

sensor = HCSR04(trigger_pin=18, echo_pin=19)

distance = str(sensor.distance_cm()) + ' cm'

print('Distance:', distance)

picoLTE = PicoLTE()

payload_json = {
    "state": {
        "reported": {
            "Distance": distance
        }
    }
}

debug.info("Publishing data to AWS IoT...")
payload = json.dumps(payload_json)
result = picoLTE.aws.post_message(payload)
debug.info("Result", result)

Credits

Ensar Karabudak

Ensar Karabudak

8 projects • 9 followers

Comments