Tag Archives: RF MODULE

MAKING A DIY PIR SENSOR

#121 Making a DIY PIR sensor on protoboard

Front of PCB on proto board

A few years ago I wanted to use some type of sensor for security purposes in my workshop.
I just needed something to sense movement and send a radio signal to my Roboguard device.
An actual Roboguard beam was too expensive, too bulky and large and was not rechargeable… not to mention a bit overkill for my application.

So I decided to look for a low power and small sized PIR sensor. Eventually I was able to find an affordable and small PIR sensor that can operate at 3.3V. I found the MH-SR602 PIR sensor which offers an adjustable delay time with a detection distance of 0 – 3.5 Metres. it has a built in regulator with a range of 3.3 – 15VDC but adds a bit of extra current draw… since I was already using 3.3V for my IC and RF circuits I was able to de-solder the included regulator to save a bit of current. This would help me greatly especially since I was going to use deep sleep.

PCB inside the box I designed it for.
Lid closed only the PIR sensor is sticking out (Radar does not have this problem)

Now the main MCU is the ATTiny212 and the RF module used is the WL102-341… not sure on the authenticity of the module but it works range is good and the current draw is up to spec + the EN pin does disable the unnecessary current draw when pulled low. The LDO regulator I used is the classic HT7333-A.

After soldering everything and checking for shorts I was able to program the MCU and then power up the device with an recycled 550mAh vape battery. First thing I noticed the device would constantly trigger the PIR. Eventually after a long time of troubleshooting I replaced one of the ceramic capacitors used to stabilize the output of the HT7333-A and now everything worked… Now when looking at the capacitor I didn’t understand exactly why it was not working, there was no short only a really high resistance and the capacity was a bit higher than the specified uf.

Before hand I made sure the PCB would fit into a standard rectangular project box. I just needed to drill a hole for the PIR sensor to stick out. After drilling a hole for the micro USB charging port the project was complete and working.

While testing I was able to achieve a very low current draw in deep sleep mode. I did some basic calculations and the MCU should last more then a year without needing a charge. Later after leaving the device in my workshop I was able to confirm this with the device lasting over a year and a half with mild triggering whenever I was working in the workshop. making use of the ATtiny PIT for long sleep timing and interrupts for waking up the device after some code refactoring I was able to make things super efficient. I programmed everything in C. ASMM is a bit to much for low level stuff in my opinion though I would like to make time to learn it one day. Still I was able to create a program of 956 bytes using ram of 18 bytes. So under 1k was nice since the smallest ATtiny size is 2k so I’ve still got plenty of space.

Current when the MCU is in sleep mode (the PIR is always running) 121.9uA roundabouts
772.2uA of current when the MCU is running but RF is not TX’ing
13.1mA during TX

One thing I can say for sure is that this project really activated a habit in me to try make everything as small and as efficient as possible whenever I program 8-bit microcontrollers for my personal projects. I must say I was also able to save some money when buying IC’s by improving my code and what can I say it feels very good once a project is completed and as small and efficient as I could make it.

With that being said sometimes when using a microcontroller like the ESP8266 or ESP32 the resource abundance feels crazy but once I start populating all that space with HTML and bitmaps + other media I quickly realized that even that space can get used up very fast.

C.A Torino

Back of the protoboard

COMMON RF MODULES IN SOUTH AFRICA

#109 Types of 433Mhz RF modules in ZA

FS1000A module at 5v no attenuator just using antenna.

Recently I have been using wireless technologies for a few projects.

While looking for a balance between price, functionality and disposability I decided to focus on the 433Mhz RF modules.

These use a free spectrum and have been around for a long time. There’s is a few different types and kinds, with LORA being kind of new and better in almost every way but this comes at a high price compared with the standard 433 RF modules.

So I purchased a few receivers and transmitters from electronics suppliers located in South Africa.

All my tests consisted of running the 4 receivers at 5v and a single 17.3cm straight LAN cable strand as an antenna. The signal sent was a 23bit ASK signal with a pulse length of 1200ms.

All 3 transmitters were tested at 3.3v with a single 17.3cm straight LAN cable strand as an antenna.

The transmitters testes were the FS1000A, CYT1 and the WL102-341.

The crude module actually has more power and range at 5V but I am using them at 3.3v for super low power applications so In this case the module loses.

The Tests were done on farm land.

All transmitters could trigger the receivers at 400m line of sight but only a few could penetrate foliage and a galvanised steel shed.

I only needed MAX 400m which is why I stopped there but some sources claim up to 600m – 800m + for these superheterodyne modules. Not as good as LoRa but for the price what reason do I need not to use them?

*Sidenote Using RF or LoRa in conjunction with a 2.4G Wifi module like the ESP32 or even 3G/4G modules can create multi dimensional divers systems. where we are leveraging the long range and penetration + power output of 433Mhz and 868Mhz but also allowing packets of data to connect over the internet to be stored on a server for data analysis and the creation of graphs to make the data more visually appealing.

Currently I do have some pilot devices and hope to one day make some good quality sensors in 3 different tiers:

  1. Cheap and disposable sensors
  2. Affordable long term sensors
  3. High end sensors

These will be focused on use within rural outdoor areas and I will have a version with Gerber files and schematics etc. available for anyone to download and make for themselves. However the more refined version with a nice enclosure and style will be sold commercially since I do want to be paid for my work.

Back to the modules..

The transmitters that support 5v could penetrate a little better sometimes.

The position of the transmitter/receiver could also greatly affect the received signal especially at range.

Also during summer and during rain the signal was worse with the foliage and water most likely absorbing and/or reflecting the signal

All receivers were superheterodyne with a crystal and I did not use any counterpoise though it would help in some circumstances it makes the receiver unpractical and large.

From worst to best

Some people may wonder why I am using these modules instead of the fashionable LoRa modules. This is simply due to cost and availability.

Designing a good circuit cost time and money. Inserting said circuit into an extremely hostile environment like for example.. rural South Africa is an even more costly exercise

I have had devices damaged by the sun, damaged by water, damaged by ants, damaged by cows, damaged by some kind of rabid animal (assuming jackal) The list goes on.

AND I have not even mentioned the human element… devices damaged by criminals some even STOLEN… for what? You telling me that criminal is sitting in the bush conspiring to reverse engineer my simple circuit and RF protocol and some how will be able to defeat Microchips code protection? I highly doubt it but it is possible…

So now I hope you can understand why these cheap modules do work and are very useful + inexpensive for my purposes.

I also have LoRa versions but for now I only use those when distance and extreme sensitivity is needed.

ROBOGUARD INTEGRATION

#105 Custom integration sensors with custom receiver

V1.0 breadboard prototype with DIY EEPROM module
V1.0 stripboard soldered prototype with USB and Lipo battery
Testing 2x custom sensors (1x ATTINY85 and 1x ATTINY412) with 433 RF modules

Recently I wanted to integrate the RoboGuard system with some custom sensors on my farming property.

This motivated me to study the hardware and RF protocols used by the RoboGuard

I would like to also account for multiple RoboGuard transmitters scattered over the property each RoboGuard device has 2x pir sensors and sends an alarm signal once both are triggered.

They also send a heartbeat ping every 15min.

They have a range of roughly 400m from transmitter RoboGuard to receiver HQ.

Testing EEPROM data storage.

Now the RoboGuard system uses 433.92Mhz to send signals to the HQ however the HQ can only add up to 8 paired RoboGuards.

Once you reach this limit you will need to purchase more RoboGuard units.

For example if you had 12 RoboGuards, 2 HQ units would be required but if you wanted an HQ that can store more than 8 you would be out of luck.

luckily I had made my own custom RoboGuard receiver and was able to add my own DIY sensors to the RoboGuard device ecosystem

The protocol used is 433.92 ASK and each RoboGuard has 3 signals

  • alarm
  • tamper/learn
  • heartbeat ping
Testing penetration behind galvanised shed (using CY33 module)

Now my receiver needs to store the received device learn UID and this is done via EEPROM on my board

Now my custom device receives all signals just like the RoboGuard HQ.

Next is communicating with the TAK Server.

I could swap the 328P for an ESP8266 which allows WiFi connectivity to the internet

This then allows the device to connect wirelessly.

It still receives RF data from the RoboGuards and just ports these signals over the internet

In future I will make a device with an integrated WiFi connection but In this case all I wanted was more zones and an affordable extra device to keep in my laboratory permanently with the capability to receive 433mhz signals walking around the premises. If need be

Overall my unit contains

A speaker
6 push buttons
2000mAH Lipo battery
built in charger
ability to add clients 12 RoboGuards (more depending on EEPROM size)
433 MHz superheterodyne receiver only
logic to handle all these features

Front of the 433 Transmitter
Back of the 433 Transmitter

More info + datasheets and schematics etc. on my GitHub here