Friday, November 15, 2019

RF Modules - RX480E-4 & TX118SA-4

RF - Radio Frequency

I recently got a RF transmitter/receiver pair from aliexpress.

I did the following video assuming that the receiver was bad!!! Apologies for the bad quality and pace.



However, it turned out to work fine!!! Just not the way I thought it would - the pin mappings were reversed in this case. There also was not much relevant documentation on the seller's page.

So below I will detail some important points about this RF transmitter/receiver pair

General Info


1. It has a encoder/decoder chips built-in. They are necessary for the process of communication. (They use some other chip - not HT12 kind).

2. They network in a different manner. You can pair "remotes" to a receiver and create a network or a channel - i.e a group of transmitters and a receiver that can communicate.

3. Typical applications include toggling a relay that controls your living room light, etc...

I am seriously considering this for two other applications:

1. Remote bike alarm - so I can find my bike in an open bike parking space.
2. Game show buzzer with a team board. When a team presses the buzzer their corresponding team's light indicator should blink.

Modes of operation


It has three modes of operation:

1. Momentary
2. Toggle
3. Latched/Interlocked

Memory Wipe


You can press the learning button 8 times. The LED will flash 7 times to indicate it has reset i.e, forgotten all its previous configuration - all transmitters and its previous mode of operation. This operation is necessary if you want to change modes. However, after doing this, you have to re-pair all your transmitters.

Learning Mode


After a memory wipe you have to first set the receiver into learning mode and then program it to one of the above mentioned modes.

To set it in a momentary mode: Press the learning button once. Wait for the LED to turn on. (This indicates its in a learning mode). On the transmitter, push any button. Or more accurately, ground a pin. Wait for the above LED to flash 3 times. (This indicates it has accepted the setting and it has come out of the learning mode). Now it is ready for normal operation.

To set it in toggle mode: Hit the learning mode button 2 times. Rest of the process remains same as above.

To set it in latched mode: Hit the learning mode button 3 times. Rest of the process remains same as above.






Configuring more transmitters


Otherwise also called "pairing". The process is exactly similar to "learning". You "toggle" the receiver into the (corresponding) learning mode. Press any button on the new transmitter. Wait for it to exit the learning mode. And you are done.

Prototype setup for testing the momentary mode of usage. 


Stuff you need


1. jumper wires
2. breadboard
3. 5V/3.3V  DC power supply module (comes with a 12V adapter)
4. 5 x LED
5. 5 x 330 Ohm Resistor
6. 4 x Momentary push button

Wiring






Note: no need to connect antennae now. Its only important for range test or applications that require a long distance.

Momentary mode operation


1. Wipe Memory first.
2. Undergo "learning" for the momentary operation mode.
3. Test different buttons on the transmitter, and, see the corresponding LEDs on the receiver end light up.

Its that simple.

The alternate learning button


You can have the VT pin on the receiver pulled high through a 1k Ohm resistor momentarily to simulate a learning mode button press. Consider this alternative when you find pressing the small button on the board cumbersome.

Have a nice day.

Extras

Video showing different modes: https://www.youtube.com/watch?v=4uW7vx6JnxI

Seller listing page: https://www.aliexpress.com/item/4000064795450.html

Post an image of your breadboard if you like... ;)

Yes. I also performed a range test at my work place - Infosys Bangalore Main Campus. Got a range of about 290 m. (Line of sight).

Monday, September 30, 2019

An overview of Join

This is like a messaging app, by the same developer of Tasker. If you want to know more about Tasker click here. PushBullet comes close to what Join does.

Here are some of the things you can do between two join devices:

1. Paste clipboard from one device to another
2. Send text notes from one to the other
3. You can send a URL from one device to the other. If the latter device happens to be a phone/browser, it will open a new tab with the URL
4. Send voice messages. You can write text on one device. It will be played over at the other end.
5. Send files...

It is possible to run custom actions. Join actions are different from Tasker. They are limited to messaging. A good example is doing a broadcast message to all devices.

However, Join also registers as a Tasker plugin. Which means you can do all of the above from Tasker.

For e.g. I use a combination of Tasker & Join to control my music playing experience.

You can also make other devices talk to join devices. Almost all common APIs are exposed over HTTP. So for something running in a raspberry pi device, all it needs is to make a http request (cURL) to the http api to get a message across.

An overview of Tasker

These are two cool android apps. But they are paid apps. However, I think buying them would prove worthy - you won't regret it. They help in a lot of home automation use cases.

What is Tasker?

This android app helps us to automate many aspects of the android phone. For e.g.

1. Automatically turn down brightness from 9pm to 7am, and, put the phone in silent mode, and, also turn on dark mode on the phone.
2. You can program your phone to show you a popup message with the content from an SMS received from your loved one...
3. You can make tasker search your sms and report your latest bank balance!

How does tasker do this?

Sparing all the intricate details, there are three high-level concepts at work...

1. Actions
2. Tasks
3. Profiles

Tasker Actions

They are what they are - actions. An action is something tasker can do. It can be broadly classified into three categories:

1. Actions that change some system setting or state. For e.g. set volume level, reject call, running an app, writing to a file, setting the alarm, clearing notifications, etc...
2. Actions that can help in networking. For e.g. make http requests, or, mqtt, etc.
3. Actions meant for notifications or interactions - toast messages, creating notifications, vibrating the phone, popups, etc.

So actions in a way are basic - they do one thing.

Tasker Tasks

A task combines multiple actions.

Tasker allows you to run tasks standalone or via means of a profile which is explained in the next section.

When running standalone tasker allows you to make shortcuts (or widgets) that you can place in your home screen. This is powerful - imagine having a task that can for instance talk to your home automation system and toggle your living room light switch...now you are controlling your living room light with your phone!!!

Tasker Profiles

A profile is a context for a task to run. A profile could be a combination of an event (like SMS message received), phone gesture, time, battery level, etc...For e.g. if you wanted your phone to turn on darkmode everday after 9pm you'd use a profile with one such "time" constraint. The associated task is the one that does the corresponding action. So as far as this small example goes, the profile is what triggered the specific task.

Tasker Plugins

Tasker has a finite set of actions and profile events. They can be extended with something called Tasker Plugins. For e.g. mqtt is something tasker doesn't provide out-of-the-box. However, there are tasker plugins which enable that feature for you. Now if you needed to send a mqtt message to some other device, you can find that specific action...Similarly tasker can respond to mqtt messages as well. There are plugins that enable this specific feature alone.

AutoApps

This is another app by the same developer. There are a number of tasker (3-rd party) plugins available today. This is a one-stop interface to get all those official tasker plugins.

Conclusion

I do recommend you explore this app. You will get hooked on to it very quickly.

Friday, September 27, 2019

Are you home power supply conscious?

Ever wondered if there is electricity at your house while you are at work? We used to live in an area of frequent power cuts. Sometimes they would take hours to come back on. And sometimes, it was simply human error: the meter reader would simply remove the fuse for the wrong apartment. In either case, my poor mother, would wait, hours on end, for it to come back on...
Hence I built a small android app using Google spreadsheet, and, Google Scripts.
That solution involved posting a "heartbeat" at a regular interval from the app. They were logged in a spreadsheet. The app at some regular interval, would get the records and there was some code written to find out if the last recorded heartbeat was quite long ago (say 15 minutes). If so, notify...
The highlight of that solution though was about recycling your old android phone which could be lying around with no real purpose other than accumulate dust.

Tuesday, September 24, 2019

Controlling your breadboard LEDs through Alexa

I am so into IoT these days. But the rate of experiments I do are small. Mainly because of travel, being stuck with something, failed experiments, blah blah blah...

But so far the journey is enjoyable. Today I thought why not show-off a bit. So here is a small wifi chip (wemos d1 mini) which is flashed with something called tasmota. (An amazing software). There are two LEDs connected to a resistor (330 ohm) (in series).



In the interest of DIY and brevity I won't detail how I did this through long and many-step instructions. But here is a gist of what I did. You may follow the images and video shared at the end of post.

1. Downloaded the latest release of Tasmota binary called sonoff.bin from the github repo
2. Flashed it onto the d1 mini using software called esptool.py (Other alternatives available).
3. Configured tasmota to connect to my home wifi router
4. Selected the appropriate device tasmota has to emulate. (Generic module).
5. Configured two GPIO pins as "relays" (on tasmota)
6. Configured friendly names and,
6.1 Enabled hue emulation (important) on tasmota
7. Ask Alexa to "discover devices"
8. Had fun...

Checkout the video and images too. (end of post).

So whats cool here?

Most people are not seasoned enough to understand this much less appreciate it. This is why I encourage DIY. So I am going to just "dive in"...you should too...

1. I didn't have to use a raspberry pi...(on an earlier exercise - I did use one such device).
2. No coding or IDEs required. (Get started with a simple Arduino project. You'll know what I mean...).
3. Except for voice recognition (viz Alexa's job) everything is intra-network. (Try something on Google Home to see what I mean - I don't have a Google Home device yet ;) ). (It only matters if you are worried about data privacy).

Conclusions

I have demonstrated the principle of switch automation - automation of your house appliances or light switches...

"Alexa, turn on bed room light" or "Alexa, TURN OFF THE DAMN TV"...the possibilities are endless.

It may not be your cup of tea. But that still doesn't physically limit you from trying...

So...Learn...Ask about stuff...Get frustrated trying...Get things done...Have fun.

PS: Perhaps Google Home might evolve into something better...I am waiting for that day... :)