set the CUL to 433.42 MHz: set CUL_0 freq 433.420 MHz
enhanced CUL’s protocol handling: set CUL_1 raw X21
activated the CUL for INSTA Funkbus (IFB): set CUL_1 raw Jr, something I have to repeat every time FHEM restarts: define ifb_modus notify global:INITIALIZED set CUL_1 raw Jr
and analysed the FHEM log while sending telegrams with a remote control
I want to share my project, building a camera and some other sensors into a dummy camera.
Why?
It started with the desire for outdoor sensors for luminosity and temperature for my home automation system. The best place would be the north side of my house. I considered dedicated hardware but could not find something that appealed to me.
A wall box would be vulnerable to passing scum, so the idea arose to put them in a dummy camera. Wireless would be the only option for getting the data to my home automation system. So, I needed something to get the data wireless, and that’s when the Raspberry Pi Zero W came into play. And why not invite a camera module to the party? And perhaps use the Bluetooth functionality, e.g. to control garden IT?
Powering with a battery would be easiest but would require quite a few batteries. Of course, I did some calculations on the expected current. I have considered a power bank with a solar panel but could not get it all adequately water-proof (ex-ante), including the cabling. So, I chose the mains, available in a junction box nearby.
The dummy camera
Well, I was searching for a dummy camera that could hold a power unit, a zero pi, a camera module and two sensors. The market prefers small and cylindrical, but I needed something boxy and spacious. Long story short, I found the Smartwares CS11D. It’s a simple design that is found under many names, but this one has the screws for the top cover on the bottom, so I think it will be slightly better weatherproof than others.
Not all screws are willing, so some tact is necessary. Inside, you find a battery box and a kind of wall that mimics a camera lens on the front side, and on the back, it has a small circuit board and some extra mounting points. The circuit board has a blinking LED wired to the battery box. The additional four mounting points seem to be there for a camera module: it matches nicely, though it could use an extra fraction of a millimetre.
The components
The circuit board holds the LED nicely, so I kept it. However, the smallest capacitor on it conflicts with the camera module, so I had to remove that and power the LED directly through one of the GPIO pins and a ground pin.
Talking about power, that is an issue. I could not find a power unit to build in appliances. I ended up with a power adapter with a USB outlet and a 20 cm short USB cable powering the Zero Pi. I had to demolish the plug to solder a power cord to it, which, of course, was nicely insulated with heat shrinks. I fixated the adapter with double-sided tape.
Screws are another thing. You need small ones, really small ones. I bought some King micro-screws online, metrical sizes 1.7 x 8 mm and 1.7 x 6 mm button-headed black metal screws, and some brass rings to add spacing. The screws fit nicely through 2 mm holes and fasten themselves in 1.5 mm holes.
The dummy camera is a metal box with a glass window on the front. That means the onboard Wi-Fi antenna is useless, and an external antenna is needed. I found an SMA antenna and an RP-SMA to uFL/u.FL/IPX/IPEX RF cable and a uFL SMT antenna connector. That connector is microscopic, and thankfully, I found a nearby professional to mount it. The antenna is placed on the back side of the casing after drilling a 7 mm hole.
I fixated the Zero Pi vertically with two pieces of plastic angle profile from the DIY store, 10 x 10 mm, and two screws. As the ribbon cable connecting the camera module is quite long, I mounted the Zero Pi with its SD card slot towards the camera module.
Of course, the two sensors must sense the world outside the dummy camera. I closed the luminosity sensor, a TSL2561, through a 6 mm hole in the bottom with some rigid, fully transparent foil coming from a box of pastry and fixated by a glue ring. The temperature sensor, an SHT31-D, closed the same-sized window with a mosquito bait sample — the sensors themselves I mounted to the bottom with two screws and some rings.
I drilled a 9 mm hole in the front ‘wall’ for the camera. As the connecting ribbon cable fits into the Zero Pi only one way and the Zero Pi has its ISB connectors on top, I placed the camera module so the text is readable upright. I then removed the protective lens covering (the green tab) and mounted the module with two 8 mm screws. It fits great!
Then, I soldered the two sensors and the circuit board to the Zero Pi. Too long wiring is less of a problem than too short.
Finally, I added the adapter and soldered the mains cable on it. I attached the earth wire to a screw and a 20 cm long USB cable to power the Pi. I insulated the mains and – quite importantly – assured myself with a voltage meter that the casing is not connected to the mains when the Pi is in service.
The software
I mounted Raspbian Lite headless on the camera and secured it with Clamav, iptables, fail2ban, cron-apt, and dogwatch.
For the sensors
I enabled I2C in raspi-config and installed i2c-tools. Then, with sudo i2cdetect -y 1, I checked the sensors’ availability on I2C.
I use FHEM as the basis of my home automation system, so I installed that on the camera too and linked the camera to my home automation server with FHEM2FHEM.
In FHEM on the server I defined the dummy modules TempHum and Lux.
Now I can use the sensor data in my home automation rules.
For the blinking led
I did sudo adduser fhem gpio ; sudo reboot.
In FHEM on the camera I
defined BlinkingLed RPI_GPIO 21, attr BlinkingLed direction output
defined Blinking at +*00:00:10 set BlinkingLed on-for-timer 0.1
defined BlinkOnAtSunset at *{sunset()} attr Blinking disabled 0
defined BlinkOffAtSunrise at *{sunrise()} attr Blinking disabled 1
Getting the signal from the camera module to my Synology Surveillance Station turned out to be a project on its own, and will be covered in another post.
You must be logged in to post a comment.