Nickduino / Pi-Somfy

A script to open and close your Somfy (and SIMU) blinds with a Raspberry Pi and an RF emitter.
Other
433 stars 108 forks source link

Flawed crystal or poor soldering or should this have worked? #129

Closed sfla closed 2 years ago

sfla commented 2 years ago

i just can't get it to work. I bought a 5-pack of transmitter and crystals, and have tried soldering it twice now. And nothing happens. As suggested (by @Ezezi3l ) in another thread I got one of these SDR-receivers and tried looking at what's actually being transmitted:

244506059_4572164926201414_785112058555696416_n The left red line is 433.42MHz, and the "wide" signal (bottom left) is when I pressed the physical existing remote for a second. So the existing remotes are definitely on 433.42MHz. The dots on the right side is what appears when I click the "same" button on the Pi (three times). Apparently, my signal is transmitted at about 433,5625MHz exactly 433,55MHz.

What can cause this? Can bad solder shift the frequency this much? Is the crystal bad or damaged? Is there anything I can do? Or is it close enough that it should be working?

To clarify what's not working; I put my blinders in "programming mode" by holding the tiny button on the remote until it "flaps" up and down once. Then I click "record" or "try again" or whatever on the Pi, and absolutely nothing happens. I can try hundreds of times, but eventually the blinders will "time out" and flap again to indicate it's leaving "programming mode" (or if I click the tiny button again)

sfla commented 2 years ago

I found my previous soldering attempt and plugged it in to analyze the signal, and it turns out that one never sent anything. But I soldered a third attempt now, and the exact same thing happens. The signal is exactly 433.55 with a new transmitter and a new crystal. (Same as earlier, even though the post/picture says 433.5625. I was apparently hovering the cursor a bit off).

Maybe the entire batch of crystals is flawed. It physically says "433.4" on the crystals, and they sold them as "433.42", so im pretty sure they're the correct ones. I hope there's another solution than to buy new crystals, because it literally took more than 3 months having them sent here from China..

Anyway, I have three different physical remotes for three different sets of blinders. Two of them transmit on exactly 433.42, the third one actually transmits at exactly 433.45. Consistently. This suggests to me that there is some wiggle-room regarding frequency here, because I'm pretty sure these blinders are identical and installed at the same time (before I moved in).

So if it's not the frequency, can it be something about the transmitted data? I do notice that the signal from the original remotes are visually quite different from the pi-signals, in this SDR-visualizer thing. I have no idea how to use this SDR-scanner/reader/whatever properly, so I don't know how to inspect the payloads, but maybe there's something there?

Nickduino commented 2 years ago

Have you checked your wiring 100 times? Can you decode the sent signal (i.e. display the frame)?

I'm afraid I have no answer to bring to the table (is that 0.1 MHz significant, can soldering make the crystal drift, what should your lines look like).

Hopefully, @Ezezi3l can share his insights about the SDR

MarkGodwin commented 2 years ago

I have to tell my story about this, and this seems as good a place as any. Maybe it will help others having radio problems... Maybe it will give you a chuckle. Probably neither.

My transmitter stopped working this morning. For the past 3 days it has been completely reliable, but this morning it was dead. No sign of movement from the blinds at all. I didn't have any more spare to try, as my only spare was already ruined in my first attempt at changing the crystal..

So I spent a lot of time today, re-soldering the crystal, testing the board out, and trying to find broken traces or bridges, but to no avail. Tried other GPIO pins, and even a whole different Pi with no luck. Then some more re-soldering - soldering every joint on the board that I could get to with my blunt-nosed iron. Still nothing.

Then I made a discovery - if I touched my finger on the crystal oscillator, then the blinds started responding again! I immediately thought it must be a loose connection or dry joint or whatnot, but then I found that if pushed down on the oscillator with a pen or anything insulated from me, then it would not work. Even more than that, if I touched the crystal with even the lightest of touches, it would work again. There were actually a few places on the board where I could place my magic fingers, and the thing works fine. But as soon as I let go - nothing. Clearly my new super-power wasn't going to help me much with my home automation dreams, though.

Well, I went onto amazon, and bought the SDR radio receiver so I could try and figure out what was going on, as well as to buy some more transmitters. "I'm saving money," I told my wife. But those weren't going to arrive for a few days, so I carried on searching and found another post on the internet with someone claiming that touching one of the inductor coils made their transmitter work. It was suggested there is some sort of human capacitance at play which maybe tunes the transmitter better or some such RF wizardry.

Maybe, I pondered, I could add a non-human capacitor to the circuit? I found schematics for the FS1000a which seem to suggest that there is an optional(?) capacitor that can be on the circuit but was clearly missing from mine. Maybe these things work "ok" without them. So what could be the harm in trying to add a capacitor? Given that I have an unused receiver that came with each transmitter that seems to be packed full of teeny little surface mount components, I thought what could be the harm in trying out one of those? I picked out likely looking brown component, and smashed it off the board by shoving it from the side with a solder-laden iron. This stuck to the nose of the iron, so I literally scraped it back down into roughly the right place on the transmitter board.

Much prodding with tweezers and gingerly poking it with the iron, I check the circuits weren't shorted out, plugged it in, and... still nothing. Well what can you expect? But still, maybe this capacitance was too high, or maybe the brown thing wasn't a capacitor at all. So what's the harm in trying just one more? This time I picked the little white capacitor, sitting next to small inductor at the corner of the receiver board. This one matches the colour of the other thing I actually know to be a capacitor next to the antenna on the transmitter board. I resolved that this would be my last attempt. If this didn't work, I would give up and try more crystals and transmitters when they finally arrive.

You can, I hope, imagine the state of my little transmitter board at this stage. Surface mount components so small I could barely focus on pushed around with all the delicacy of moving ants with a spade, speculative bodge wires connecting together legs... but this time it actually worked. It actually bloody well worked!

I have no real idea why it stopped working in the first place, but adding the capacitor has apparently fixed it for me. In the back of my mind I'm still wondering whether it's the air pressure or humidity or another source of interference that has coincidentally just disappeared. But I don't care right now.

I will see if I can figure out anything more conclusive about what the capacitor is doing to the signal once the SDR arrives, as I have to make some use of it now I have it. I will report back if I learn anything...

sfla commented 2 years ago

@MarkGodwin This gave me a laugh, great writing! It seems my issue is different, sadly. No matter how or where I fondle my transmitter, the frequency stays exactly at 433.550. However, maybe my fondling-abilities aren't what they used to be. Looking forward to seeing you report back with insight into what your gentle caress can do. If your transmitter is at 433.55 too, without the capacitor, I will definitely ask my wife to touch it.

EDIT: You know what? Touching the crystal does nothing for me, but if I push down pretty hard on the squiggly copper wires, the signal goes from 433.55 to 433.51. Interesting.

sfla commented 2 years ago

I now tried to connect one of the still-original transmitters (433.92MHz), which I never tried before, and am baffled to see that they are actually transmitting at 433.975 for me. And with finger it's 433.9375. That's 0.055MHz beyond target without finger, and 0.0175 with finger. In my tests with the soldered ones, they are off by 0.13MHz without finger and 0.09MHz with finger, which is way more, and I have no idea if any of that is relevant.

I have no idea about anything. I am a total noob and understand nothing about hertz, voltage, current, watt, resistance, whatever. I've tried different connections on the PI. i've been using GPIO4 which was default, but have also tried GPIO17 (and changing in conf), but with the same result. I also tried GPIO2, which is pink in the graph, and with some additional stuff, and that just made it transmit constantly. I guess I need to find a way to change the power output output from the pi?

MarkGodwin commented 2 years ago

My SDR arrived, as well as two new transmitter modules, so I did some investigation...

My original transmitter that has never worked doesn't appear to transmit any signals at all, so I must have broken one of the components - or it was faulty in the first place.

Other points I would make... The signal strength of the transmitter seems to pretty much match that of the Somfy remote - in that it "sounds" about the same, and the spectrum analyser looks about the same. This seems to be the case regardless of whether there is an aerial connected. I can't see any difference in the signal from my "good" transmitter to that of the Somfy remote in the spectrum analyser, unlike your trace above. Therefore, I suggest there is something wrong with your transmitter, either in the wiring, the soldering or the crystals.

I'm kind of tempted to smash the capacitor off my previous transmitter to see what it broadcasts at then (if at all). My guess is it's not oscillating properly until the capacitor is attached.

MarkGodwin commented 2 years ago

I added a capacitor to the completely broken one, but when testing the continuity found that the little surface mount inductor (the thing underneath the missing second small coil) wasn't connected. After dabbing some solder on that, it now transmits a little bit above 433.42 (with capacitor).

Nickduino commented 2 years ago

Maybe it will give you a chuckle.

It absolutely did

I'm kind of tempted to smash the capacitor off my previous transmitter to see what it broadcasts at then (if at all). My guess is it's not oscillating properly until the capacitor is attached.

We need to know!

Scrath1 commented 2 years ago

I also have a lot of problems getting the transmitter to work properly. I had one functioning last year that somehow stopped working over the winter. With no way to troubleshoot it I also ordered and SDR and was able to see that it didn't send any signals anymore. Luckily I still had some leftover transmitters and crystals from the previous attempt so I first tested an unmodified transmitter which worked flawlessly at 433.92Mhz. Then after desoldering the crystal I wanted to try multiple of my remaining 433.42Mhz crystals to see if a some were more accurate than others (based on what I read here).

To try that out I soldered some wires to where the crystal would be attached and plugged them into the breadboard so I could more easily swap crystals. Then nothing. It didn't work. I was already hovering above the buy button for a new bunch of transmittors when I decided I would first try properly attaching the crystal how its meant to be. Suddenly the transmitter worked again although it was pretty weak without an antenna and wasn't transmitting on quite the correct frequency.

Nevertheless I resoldered it onto a tiny perfboard so I can directly plug it into my Pi 1 which I am using as a server for this. The first test without an antenna worked and I was able to move the shutter again.

Next I attached my homemade antenna which I had successfully used with my previous attempt last year. Suddenly the transmitter stopped working again.

I have an arduino set up on my desk where I can plug in the transmitter which will send a signal once per second. After I couldn't get the transmitter to work in the Pi I plugged it into the arduino again where it worked flawlessly.

Thinking that it worked perfectly before attaching the antenna I desoldered it again but still couldn't get it to work. Tried it again using the arduino. It sends a signal without any problems.

So what is the difference between the arduino and the Pi? The first thing I though was that maybe the Pi was shielding the antenna or something but I have no background in all this radio stuff so I have no clue.

The other difference is that the arduino is connected to the antenna using jumper cables while the adapter board enables me to plug it into the Pi directly. So the next thing I tried was using some dupont jumper cables to connect the transmitter to the Pi (still without an antenna attached). Suddenly its working again.

Next I reconnected the antenna while still using dupont cables for the connection between the Pi and the transmitter and it is still working (and sending on a frequency of 433.46Mhz).

To test if the positioning on top of the Pi caused some issues I held the transmitter above the Pi and let the program sent a stop command. The strength of this signal was unchanged no matter how I positioned the transmitter on top of the Pi or next to it.

This leads me to believe that the length of the wires going to the transmitter are the cause of it working or not working. I will try using a bigger antenna next without the dupont wires

For the record, this is how my transmitter currently looks (using the homemade antenna that I had success with last year). I have the crystal standing up a bit because I read in some issue that this fixed someones problems though I don't know if this actually helps at all. 1650798781633 1650798781623

Scrath1 commented 2 years ago

After attaching a longer antenna stolen from a CC1101 I still have the same results. With dupont cables between the transmitter and the Pi it works. Without it doesn't.

Here's a picture of the antenna I used for this test longer_antenna

Anyway, another thing I noticed during testing was that my Pi is continuously broadcasting something as soon as I plug in the USB cable before I send the first command.

This is what the signals look like while booting the Pi during_boot

and here's what it looks like as soon as I send a first signal after_sending_first_signal

Maybe it would make sense to manually set the data pin to low when starting the program?

MarkGodwin commented 2 years ago

I knew it before, and I still know it now - the dark art of analogue radio circuits is well beyond me. However, mine has been working reliably since my random escapade with capacitor soldering. I am using dupont jumper cables, though. I also have a little mount inside my project box which keeps the transmitter a little way away from the PI. What kind of PI are you using? I'm on a Model 2b. Perhaps there is some interference from USB3 or something like that on newer models?

Scrath1 commented 2 years ago

I am using an ancient Pi 1 since its so underpowered that I don't know any other projects for it. It's basically dedicated just to this project. Definetely no interference from USB3 though ;D

I had also tried using a capacitor when attempting to fix my old previously working sensor. What capacity did you use? The smallest I have is 0.22uF. I might try that next. I had mine soldered on the 2 empty pads on the side where the antenna is connected. Is that the correct spot?

MarkGodwin commented 2 years ago

I pinched this one off the transmitter board. I'm not sure it really helped at all, but it did appear to alter the frequency, and did magically restore a non-working transmitter IMG_0115(Edited) - Copy .

Nickduino commented 2 years ago

No idea if that helps but my transmitter is on top of my Pi case WITH A GROUNDED SHIELD IN BETWEEN and long-ish cables.

Scrath1 commented 2 years ago

So I finally had some time to experiment some more and found out that the antenna length and shielding from the Pi are irrelevant. Also the cables don't matter either.

To test this I first started to use an antenna that I received together with my SDR that is specifally meant for 433MHz and tried it without any luck.

Next I tried to put some shielding between the Pi and the transmitter by using a grounded piece of aluminum foil that was isolated using duct tape. This also didn't help at all but at least it looked kind of funny in my opinion. 1651328925849

After nothing else had worked I decided to test all connections once more using the multimeter which was the moment I nearly facepalmed myself. 1651344773178 I had a short between the data and a ground pin when the transmitter is mounted. The reason I hadn't detected this earlier was that this ground pin wasn't meant to be used at all so it is only connected when the transmitter is directly mounted to the Pi.

On the upside I can now confirm that the frequency for the blinds doesn't have to be exact. My transmitter is sending at roughly 433.5MHz and my blinds still react to it. I can also confirm that touching the oscillator with my finger changes the frequency toward the desired 433.42MHz though it doesn't reach it.

I can also quite confidently say now that the antenna length doesn't matter beyond the recommended 17cm since I tested antennas that were much longer. I can't say if it will be the same with shorter antennas though.

I didn't manage to test the capacitor that MarkGodwin recommended since I couldn't get one off the receiver board. Instead I tested a 0.22uF capacitor which caused the transmitter to not function at all.

Scrath1 commented 2 years ago

Small update from me: The transmitter stopped working again. Apparently the oscillator died because replacing it fixed the issue. I wish I knew why they keep dying though

Nickduino commented 2 years ago

Glad it's working :-)

On the upside I can now confirm that the frequency for the blinds doesn't have to be exact. My transmitter is sending at roughly 433.5MHz and my blinds still react to it.

0.08 MHz is pretty close in my books. I wouldn't work with 433.9, though.

Agreed on the antenna: the blinds aren't too picky (probably because they're tuned to 433.42 MHz), mine kept working with a broken antenna...

RicharddeCrep commented 2 years ago

First of all, thanks Nickduino et al for your great project. I'm a Pi novice and so have had to hang off every tiny instruction. But the system cam up well and (after one problem that took a few hours to fix) I have had no problems with the transmitters.

I had trouble getting the PiSomfy tranmitter to be recognised-accepted by two out of three blinds. Repeating the programming stage with the hand held remote made no difference, the two misbehaving blinds would not respond to the PiSomfy commands. ((To be clear, one blind did work as expected).

Then I somehow realised that Somfy blinds probably store a finite numberr of transmitter codes. It might be 10, I have no idea, and I could not find any specs at the Somfy web site. But the count is finite and so I thought perhaps that in my practive programming efforts, that I had consumed all the programming code slots in the two misbehaving blinds.

So I factory reset the two misbehaving blinds. (https://www.youtube.com/watch?v=sTGraGEfEH4) I then had to train the original Somfy transmitter again. And then I was able to add the Pi controller to the blinds with no problems. (https://www.youtube.com/watch?v=z3FQa_RRXKw)

I hope this helps people who have a working PiSomfy system, but have problems programming blinds to accept the Pi Somfy transmitter.

Nickduino commented 2 years ago

So I factory reset the two misbehaving blinds. (https://www.youtube.com/watch?v=sTGraGEfEH4) I then had to train the original Somfy transmitter again. And then I was able to add the Pi controller to the blinds with no problems. (https://www.youtube.com/watch?v=z3FQa_RRXKw)

GREAT!

I THINK I've read around 10 remotes but that may vary from blind to blind