danielchagasrs
Posts: 8
Joined: Sun Oct 30, 2016 10:01 pm

Send data string through a GPIO output

Sun Oct 30, 2016 10:19 pm

Hi. Greetings from Brazil.

I'm new here, and relatively new in the Raspiberry Pi world.

I have an universal 433Mhz Receptor board (a simple 2 relay board, used to control door garage etc etc...), and I'd like to control this from my Domoticz Server, but I don't want to use a 433 transmitter, because HT6p (or "Code Learning") is very insecure and can be easily cloned.
This relay board has a simple 433 receiver board (model XY-MK-5V)Image,
It has 4 pins (vcc, data, data, ground). I can use this same board, attached to my Rpi, and sniff the code from my remote. If I could send this same through a GPIO output straight to the data pin, then the IC on the relay board would react the same way as if I pressed the remote control button.
This way, I could generate my own code, set this code on the relay board (using the program/code learning button on the board) and then sending this code from Gpio/Domoticz.
But I haven't found a way of send a data string (an Integer, in fact) over a Gpio, since it just states 1/0 or high/low ...

Any ideas?

(sorry for my English)

scotty101
Posts: 3958
Joined: Fri Jun 08, 2012 6:03 pm

Re: Send data string through a GPIO output

Mon Oct 31, 2016 9:40 am

Someone else has already solved this problem.

viewtopic.php?f=37&t=66946
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Send data string through a GPIO output

Mon Oct 31, 2016 10:30 am

Could you post a photo of the relay module (with receiver board)?

danielchagasrs
Posts: 8
Joined: Sun Oct 30, 2016 10:01 pm

Re: Send data string through a GPIO output

Mon Oct 31, 2016 10:32 am

That's not what I want...

I want to eliminate the 433 receiver module, and use WIRED connection between Rpi and the Relay board.
If I'm going to eliminate the 433RX, there's no point adding a 433TX...

danielchagasrs
Posts: 8
Joined: Sun Oct 30, 2016 10:01 pm

Re: Send data string through a GPIO output

Mon Oct 31, 2016 10:45 am

This is the relay board... the the model doesn't matter. All those boards receive data from the 1 RX pin (data pin), and a microcontroller reads this data, and return an programmed action (relay on or off, pulse, timer...).
This board has an NXP IC.

Image
Image

The main reason I want to eliminate the 433 communication, is security.
Burglars are using chinese remote controls to clone signals. Some are using small arduino to sniff codes....

The second reason I want to do this, is: Sending data over onlye 1 wire, makes it possible to control dozens, maybe hundreds of relays, using only one GPIO pin.

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Send data string through a GPIO output

Mon Oct 31, 2016 10:53 am

I can see what you want to do:

Disconnect existing RF receiver from relay board and connect Pi to create appropriate signal (removing RF code).

The Pi can indeed generate complex waveforms on its GPIO pins, The post previously linked does this, simply connect the GPIO to the relay boards RF input instead of to a RF transmitter output.

Is HTP6 a rolling code protocol (code changes each transmission) or a static code?

If its a rolling code then I havent seen any 433MHhz libraries for the pi yet which deal with rolling code. You may be better off replacing the relay board with a relay board gor the pi.
Doug.
Building Management Systems Engineer.

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Send data string through a GPIO output

Mon Oct 31, 2016 11:05 am

http://abyz.co.uk/rpi/pigpio/examples.html#pdif2__433D will let you make up your own code and code length.

danielchagasrs
Posts: 8
Joined: Sun Oct 30, 2016 10:01 pm

Re: Send data string through a GPIO output

Tue Nov 01, 2016 12:32 am

BMS Doug wrote: Is HTP6 a rolling code protocol (code changes each transmission) or a static code?
It's static and no encryption (AKA as "learning code").

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Send data string through a GPIO output

Tue Nov 01, 2016 4:31 pm

danielchagasrs wrote:
BMS Doug wrote: Is HTP6 a rolling code protocol (code changes each transmission) or a static code?
It's static and no encryption (AKA as "learning code").
So capture the expected code and send it through a gpio pin to the relay input.
Scotty's link has the details, just connect directly to the relay board in the place of the receiver instead of using a transmitter.
Doug.
Building Management Systems Engineer.

danielchagasrs
Posts: 8
Joined: Sun Oct 30, 2016 10:01 pm

Re: Send data string through a GPIO output

Thu Nov 03, 2016 9:00 pm

Just to update:

It didn't work.

When I use codesend, or _433D to send the code direct to the gpio pin, the relay board doesn't detect data.
Joing one GPIO-OUT to a GPIO-IN and running codesend and rfsniffer on two terminal windows shows data being received, so it's sending data through gpio-out (in my case, I was using gpio17).

I don't know how the data is treated by the 433RX and passed to the microcontroller on the relay board... maybe it's not a direct integer, maybe it receives data as binary or something else... The fact is: Sending code with 433D or codesend, over a wired gpio, didn't work.

Any ideas?

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Send data string through a GPIO output

Fri Nov 04, 2016 10:41 am

Could you post a link to the board you have or a photo?

You may be able to send a simple on off signal to a part of the board to trigger each relay.

danielchagasrs
Posts: 8
Joined: Sun Oct 30, 2016 10:01 pm

Re: Send data string through a GPIO output

Fri Nov 04, 2016 12:32 pm

joan wrote:Could you post a link to the board you have or a photo?
There's a photo, a few replies above. There's no link, because it's home made (not by me).
joan wrote: You may be able to send a simple on off signal to a part of the board to trigger each relay.
Thank you for your suggestion, but that wouldn't work for what I need.
My idea is save GPIO pins and contact with existent hardware (main gate, garage door, this relay board, E27 light sockets and other things).

For exemple: If I have 8 devices (8 relays, or 8 individual chanels) controlled by some 433Mhz remotes, I would need 8 GPIO pins to activate those devices... That's a lot of waste, considering the small amount of GPIO available on the Rpi.
But, let's say, if I could "broadcast" data over the wire, with the proper code, I could use only one GPIO output, wired to all those devices, and only the device who recognize the code flowing over the wire would reply with proper action. All other devices would just ignore the code, since it would not be programmed inside their individual micro-controllers.

To make it a little more clear, let's suppose that:
-> Main gate uses code 88881111
-> Light socket uses code 88882222
-> Relay board channel 1: 88883333
-> Relay board channel 2: 88884444
All 4 devices are wired to a same Gpio output, let's say GPIO5... If I send "88882222" to GPIO5, all devices will receive this code, but only the light socket would recognize it as a valid code.

It would be easily accomplished If I just use a simple 433 Transmitter hooked to a Gpio output, but as I said before, it's insecure and there are reports of criminals cloning signals to gain access to residences.

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Send data string through a GPIO output

Fri Nov 04, 2016 12:41 pm

The only image I can see if of a receiver module. We need an image of the relay module plus receiver in situ.

danielchagasrs
Posts: 8
Joined: Sun Oct 30, 2016 10:01 pm

Re: Send data string through a GPIO output

Sat Nov 05, 2016 1:59 am

joan wrote:The only image I can see if of a receiver module. We need an image of the relay module plus receiver in situ.
https://http2.mlstatic.com/receptor-pro ... 016-F.webp

and

https://http2.mlstatic.com/receptor-pro ... 016-F.webp

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Send data string through a GPIO output

Sat Nov 05, 2016 9:57 am

For those like me who don't have a webp enabled browser.
b1.jpg
b1.jpg (56.75 KiB) Viewed 3825 times
b2.jpg
b2.jpg (59.7 KiB) Viewed 3825 times

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Send data string through a GPIO output

Tue Nov 08, 2016 10:31 pm

danielchagasrs wrote:Just to update:

It didn't work.

When I use codesend, or _433D to send the code direct to the gpio pin, the relay board doesn't detect data.
Joing one GPIO-OUT to a GPIO-IN and running codesend and rfsniffer on two terminal windows shows data being received, so it's sending data through gpio-out (in my case, I was using gpio17).

I don't know how the data is treated by the 433RX and passed to the microcontroller on the relay board... maybe it's not a direct integer, maybe it receives data as binary or something else... The fact is: Sending code with 433D or codesend, over a wired gpio, didn't work.

Any ideas?

Just to check, you also connected the ground between the pi and the relay board?
Doug.
Building Management Systems Engineer.

danielchagasrs
Posts: 8
Joined: Sun Oct 30, 2016 10:01 pm

Re: Send data string through a GPIO output

Tue Nov 08, 2016 10:59 pm

BMS Doug wrote: Just to check, you also connected the ground between the pi and the relay board?
No, just connected gpio output to data input...
I don't see any reason to do that, but i'll try it as soon as possible.

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Send data string through a GPIO output

Tue Nov 08, 2016 11:25 pm

danielchagasrs wrote:
BMS Doug wrote: Just to check, you also connected the ground between the pi and the relay board?
No, just connected gpio output to data input...
I don't see any reason to do that, but i'll try it as soon as possible.
Yes, you need to connect the grounds together as well, without a completed circuit there is no way for the data input of the relay board to sense that the pi's output has gone high.
Doug.
Building Management Systems Engineer.

Return to “Automation, sensing and robotics”