Introduction: Remote Level
A friend of mine has a touring caravan. Upon arrival at a site, he needs to ensure his caravan is level both front to back & side to side!
Getting the caravan level from side to side involves a ramp under the lowest wheel and a spirit level inside the caravan. The caravan is reversed onto the ramp and the spirit level checked- this can be 3 or 4 attempts getting in the car, reverse a little, out of the car, into the caravan, check the level etc etc.
Front to back level is achieved by adjusting the jockey wheel, into the caravan, checking the level, adjusting the wheel, checking the level etc. etc.
So I am making a remote reading spirit level.
Initially I used Bluetooth and a mobile phone app made with App Inventor 2, however, the updates were too slow (about 1 second frequency).
I had already purchased a 1.44 inch 128 x 128 display to play with so I decided to use it in this project!
Step 1: The Transmitter
For the transmitter (& the receiver) I used the NRF24L01 transceiver
I also purchased a bubble spirit level, the type for a camera hot shoe seemed best for the job!
The Arduino code is a mix of a couple of test programs with a tweak.
I used 2 x 3.3v Arduino pro mini's for the project. Currently I am using AA size batteries, but these will be changed in the final project to button cells.
When using the NRF24L01, it is most important to solder a 10uF capacitor directly across pins 1 & 2 (observing the polarity) as this has a big effect on transmission / reception range!
the connections for the NRF are as follows :-
NRF Pin Arduino Pin
1 (Gnd) >> Gnd
2 (+ve) >> 3.3v
3 >>>>>>> 9
4 >>>>>>> 10
5>>>>>>>> 13
6 >>>>>>>> 11
7 >>>>>>>>> 12
8 >>>>>>>>> N/C
See this link : http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
Step 2: The Sensor
For the sensor I used an analog accelerometer. ADXL335 .
This is a great little device which gives X, Y & Z as an analogue value.
I only use X & Y.
I used the joystick example for the transmitter / receiver so the code variables for X & Y from the ADXL are called joystick, but any variable name would suffice.
Code snippet :-
GND to Arduino GND
VCC to Arduino +5V
X to Arduino A0
Y to Arduino A1
Step 3: The Receiver & Display
The receiver and display share the same bus on the Arduino pro mini - only the CS (or SS) are not shared !
This particular display used the TFT_ILI9163C.h & Adafruit_GFX.h libraries.
Connections are as follows :-
Display > NRF Pin > Arduino Pin
Gnd >>>1 (Gnd) >> Gnd
Vcc >>>2 (+ve) >> 3.3v
A0 >>>>3 >>>>>>> 9
SCK >>>>5>>>>>>>> 13
SDA >>>>6 >>>>>>>> 11
7 >>>>>>>>> 12 NRF only
8 >>>>>>>>> N/C NRF only
Reset 3.3v Display Only
LED 3.3v Display Only
CS>>> NRF 4 Arduino Pin7
CS for Display Arduino Pin 10
The display isn't the fastest I've used and the screen refresh does not work like others I have tested. By this I mean,when I draw the level bubble, & then another say, 10 pixels to the right, I have to erase the previous bubble else I end up with 2 !
But this display is more than adequate for this project.
Step 4: Making the Boxes
I have not yet fitted the transmitter or receiver in their cases yet as I am waiting for a couple of switches & battery holders. However, to cut the square holes I found this Dremmell saw which made the job a tad easier !
Ebay - 6Pcs Wheel Cutting Blades Set HSS Saw Disc for Dremell Drills and Rotary Tools
I drew the cut out on a sticky label, and cut as much as I could with the saw attachment ! I finished off with a craft knife!
Step 5: The Code & Video
I have attached the Arduino code for both the transmitter & receiver.
The short video shows the prototype in action. [https://www.youtube.com/watch?v=B4nnSbflv7Y]
I hope you find some, if not all of this project useful.