Posts: 2
Joined: Fri Nov 08, 2019 10:42 am

Setup Automation Camper RV multiple Pi's and Arduino

Fri Nov 08, 2019 5:43 pm

Dear community,

I'm looking for some startup advice on how to setup my project and which functions/packages/libaries to use. Is it for example better to use one big script or smaller ones?

I want to automate my own converted Camper RV and I love to measure everything. The things it needs to do are:
* Controle all the lights, make them dimmable and control the RGB (some individual addressable and some via normal RGB strips PWM)
* Read the information of the CAN bus and if possible, control it (Renault Master)
* Combine the four camera's around the RV to make one flat video with a static picture of the top of my RV in the middle, this should also be able to switch to nightvision (I still need to install the camera's and will probably go for USB camera's)
* Start recording 10 seconds before there is a movement on the camera's (record on RAM (if possible) and write to harddisk when movement is detected
* read all kid of sensors (over I2C);
* Log all changes (I'm thinking on using an MySQL server on the Raspberry Pi)
* Display information on small displays (over I2C)
* Be able to control everything via a browser and have a button in my RV the will kill the control from outside
* Make a hotspot from 4G internet of switch to wifi when a know wifi spot is within range and has a good signal

I now planned on making different Python scripts which I planned to run simultaneously. At the center I want to use a Raspberry Pi 4, use an Arduino for the CAN bus conversion and another Raspberry Pi to display and control everything from the dashboard of the RV using a touchscreen. I don't know jet if I should run these in a or multiple virtual environments and how to share variables (can I make them global or write en read to the MySQL server?), so please advise.

Drawing of components see attached.

Here's how I planned my scripts now, but please inform me if there is a better way, while keeping things organised. Everything will be run on the Raspberry Pi 4.

Script 1:
* Read all sensors and log changes
* Read all status from other scripts and log changes
* Read all error messages
* Write all changes and send them to the MySQL server
* Sent warnings by SMS when something important needs to be shown

Script 2:
* Import and control CAN bus
* Button inputs
* Use sensor inputs from other scripts to control outputs
* Control all outputs incl. RGB

Script 3:
* Motion detection on camera's when GPS and XYZ sensor senses no big movements (to avoid recording everything while driving)
* Combine camera's to helicopter view
* Add turning circle on helicopter view
* Write to harddrive (on a NAS over Ethernet)

Script 4:
* Run webserver and add all the controls
* Make the camera's steam over the internet or sent in high quality withing the local network of the RV
* Log who accesses it
* Make access control (also need to find a way the Pi is not easily hacked

Script 5:
* Control all small displays in the RV
* Control a touchscreen in the RV

Script 6: (i think I'll run this on the Raspberry Pi in dashboard/cockpit)
* start a browser in full screen and lock it so it stays in full screen
* Switch automatically to helicopter view when RC is put in reverse
* Turn of screen with the push of an external button (or is it better to shutdown the compleet Pi?)
* I need to find a very light only browser Raspberry Pi distro

I hope you would like to help and educate me and am looking forward to your response!!!

Greetings Tim.
Drawing of components
20191108_185738b.jpg (108.01 KiB) Viewed 895 times

Posts: 1697
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Setup Automation Camper RV multiple Pi's and Arduino

Fri Nov 08, 2019 7:29 pm

Hi Great project, lots of scope..

You might want to take some time to check out how the home automation folk do what they do as it involves a lot of things like rgb/pwm led control and lots of computer to computer data sharing communication.

For example you could host mosquitto mqtt broker on one of your Pi puters This sets up a communication protocol so that any computer and some devices on your network can both publish and subscribe to 'Topics' a topic is an address/pidgeon hole type thing ;) Publishers 'write data to the topic and subscribers read the data from the topic..
but this explains better than i can.
http://www.steves-internet-guide.com/in ... on-client/

And along side mosquitto you could also host an admin system. I personally use node red, its a lightweight compared to some systems like open hab home bridge etc.. But is very powerful once you get the hang of it with a basic drag and drop interface for creating your flows.. ( Its a dataflow centric approach..)
Node red can handle i/o data saving to file or dbs, and through its flows can set up all sort of conditional tests and triggers. and serve up a web dashboard for gui io control (graphs buttons etc..)

For wireless control of leds and contact with further independent sensor inputs you can look at using cheap esp8266 dev boards and devices and flash them with Tasmota Firmware which has built in support for mqtt and most sensors and led options giving you access to sensor data and control of your leds without any programming just a little well documented configuration.

While i may have championed the tools that i personally use for my own home automation fun and games, they are not the only options.its a popular pursuit with a wide scope so look arround for the tools that lok the best suited to you..

Posts: 2
Joined: Fri Nov 08, 2019 10:42 am

Re: Setup Automation Camper RV multiple Pi's and Arduino

Sat Nov 09, 2019 2:50 am

Hi PhatFil,

Thank you for responding and I didn't think of looking at home automation, so that is something to look into!!

I why like to upgrade my Python skills along the way, so I hope to find those codes also as a possibility. But now I know where to look, I'll probably find many different options :).

Return to “Automation, sensing and robotics”