Page 1 of 1

can anyone tell me how to make library for any sensors

Posted: Wed Apr 06, 2022 5:08 am
by sepehr jami
hi. i just want to make library for some modules connected to esp32 via micropython.
i need to connect esp32 to Ethernet and couldn't find any library to do it.
so i guess i need to develop one
besides i use some libraries for temp and hum like aht10 and dht11 and I'm curious to know how exactly they work.
i googled it but couldn't find any useful explanation.
does anyone have any idea how to learn about how to make libraries for digital and analog modules? Any sources?
and I'm new to iot and micropython stuffs so need something for dummies i guess :)

Re: can anyone tell me how to make library for any sensors

Posted: Mon Jul 18, 2022 5:05 am
by tepalia02
There is no straightforward tutorial. But I think it is possible to figure out if we study what's inside the existing micropython libraries.

Re: can anyone tell me how to make library for any sensors

Posted: Mon Jul 18, 2022 7:36 am
by jimmo
sepehr jami wrote:
Wed Apr 06, 2022 5:08 am
i need to connect esp32 to Ethernet and couldn't find any library to do it.
It does depend on which board and version you're using, but when supported you get a `network.LAN` class. https://docs.micropython.org/en/latest/ ... k.LAN.html
sepehr jami wrote:
Wed Apr 06, 2022 5:08 am
besides i use some libraries for temp and hum like aht10 and dht11 and I'm curious to know how exactly they work.
There's a dht11 driver built-in to MicroPython.

Are you asking how the driver works and how it's built in? Or how does the actual signalling to a dht11 module work?

For the former at least, see https://github.com/micropython/micropyt ... dht/dht.py and https://github.com/micropython/micropyt ... /dht/dht.c
sepehr jami wrote:
Wed Apr 06, 2022 5:08 am
does anyone have any idea how to learn about how to make libraries for digital and analog modules? Any sources?
This book might be helpful: https://www.oreilly.com/library/view/pr ... 491972724/