Introduction: The RatPhone - 3G FONA Arduino Cellular Mobile Cell Phone With Retro Push Button Keypad and Rat Catching App
Never mind the iPhones and Androids. Here's the ratPhone! This is definitely NOT a smart phone. But it's not a stupid phone either. You will not be able to waste endless hours on Facebook or Twitter, but it will help you catch rats and other pests that would otherwise eat all your potatoes.
My overiding requirement with this project was that the code used should be really simple and well documented so that I could come back to it at any time in the future and understand what I had done. For this reason I have deliberately kept the first part of the project limited to the most basic functions - type in a telephone number, make a call, answer a call and hang up. It would be easy to get carried away with using endless functions and creating complex menus, but to understand the core elements of the code it really does need to be kept simple as elaborate menus and sub menus can easily make it incredibly confusing. On top of this, I devised a very simple rat catching function based on a infra red break beam sensor and detector. The rat enters the trap, the trap closes, the rat breaks the invisible IR beam, and a text message is sent to my personnal phone to tell me that the trap is activated. No rats were hurt during this project and all rats caught were released unharmed into the bottom of my neighbour's garden.
Why would we ever want to build our own mobile phone? One good reason is if we lived in an area of poor reception - modern phones have no aerial socket and it is impossible to connect any type of aerial to them. This project has an aerial socket so we can have our yagi style aerial mounted up a 50' pole if we wanted to. But the best reason of all is the unlimited number of Apps that can be created to do things that no iPhone etc. can do.
This project works on an Arduino Uno, which only just has enough pins and memory to operate the TFT screen, toggle switch, keyboard and FONA 3G cellular module. - but it works well. It could easily be upgraded with an Arduino MEGA to get extra sensors attached. Be aware that many other boards would not be compatible.
Step 1: Parts Required
Lithium Ion Polymer Battery - 3.7v 1200mAh (Check that the 2-pin JST-PH connector is wired the right way around)
3G sim card (mine is on the UK based 'three' network)
3.5mm Audio headphone/mic splitter adapter jack - adapts an Iphone type 4 pin socket to separate sockets for headphones and mic.
Headphones and microphone
Hackable Prototyping board (See photo above)
Arduino stackable header sockets
Power supply (See step below)
Step 2: Power Supply
This device will only work properly with a decent power supply - NOT the power supply on the Uno. It will work to a point, but the toggle switch will produce errors due to the lack of voltage available. Check that the whole device is running at a full 5 volts with a multimeter.
The Hackable Prototyping Board has a facility for the power supply, with the following components:
7805 Regulator To-220 (tru)
470uF 16v Radial Electrolytic Capacitor
100uf 25v Radial Electrolytic Capacitor
2.1 PCB DC Power Socket
HEAT SINK TO-220 + screw
Step 3: Setting Up the FONA 3G Module
Please use the above tutorial to set up and test your FONA.
Step 4: Keypad
If we did not understand how the keypad worked, it would be very confusing. Basically, rather than having 12 separate pinouts for each key, a matrix type keypad uses a 2 dimensional arry to describe any given number stroke. For example, number stroke '5' is a combination of column 2 (Pin 7) and row 2 (Pin 1). When the Arduino gets a simultaneous signal from pin 7 and pin 1 it deduces that keystroke 5 has been pressed. Clever hey?
*Notice that there is no 'earth' connection*
Output pins of keypad:
...... Ignore the first and last pins as they do nothing.
- ....... A0
- ....... A1
- ....... A2
- ....... A3 (Shared with toggle switch)
- ....... A4
- ....... A5
- ....... D6
Step 5: Code for the Phone
This code contains everything required for the basic phone functionality.
There are a lot of libraries used and these will need to be downloaded and installed into the Arduino software in the normal way: Library Tutorial . Never try to install a library in an 'adhoc' manner!
As you will see, every pin on the Arduino is used and one is even multitasked. Upgrading to an Arduino Mega from the start of the project would have been a better idea.
Step 6: Break Beam Frame
The break beam frame is made by cutting 45 degree angles at the ends of the individual lengths and welding together as in the photos above. The sensors themselves have small 3mm holes drilled in them which allows them to be bolted into the inside of the angle with a little bit of assistance with a file. In this way the delicate lenses are protected from being broken when installed on the cage and being attacked by captured rats.
The wires from the sensors are joined together according to their colours and we are left with 3 wires coming out of the assembly - GND, 5V and signal. In the Arduino code, a pull up resistor is initiated on the signal wire.
A strain relief fitting is used in the middle of the frame and all the wiring is protected by wrapping with electrician's insulating tape.
The finished assembly is attached over the humane rat trap with zip ties, making sure that the beam is not obstructed by the mesh.
Step 7: SMS Rat Detector Code
In rat detection mode, this code is uploaded to the Arduino.
Type in your telephone number in line 13:
#define CALL_NUMBER1 "00000000000000000"
There's a whole load of beeps, TFT and serial messages to reassure us that the device is working properly.
Step 8: Testing the Rat Detection App
I uploaded the rat detection code and tested the break beam detector in a simulated rat capture. The whole system worked really well although I had to wait about ten minutes for my iPhone to find the SMS message due to bad reception.
Step 9: Other Applications
Apart from detecting rats in a trap, this device could be used for a whole range of other projects. The break beam sensor could trigger an SLR camera to photograph wild life, which is a million times better than using a PIR found in most dedicated wildlife cameras. From the photographer's point of view, we can set up the camera with the correct focus as we know exactly where the animal is going to be and get a really good professional result.
A more ambitious project would be a GPRS remote weather station where the data collected from the instruments is sent directly to a website database via MYSQL and PHP code. The unit itself would be relatively easy to build as the sensors themselves are very simple devices. Also, it could be powered by a solar panel to avoid cabling. ***** UPDATE ****** This new project has started and I've currently got the FONA successfully sending data to my database and website.
Runner Up in the
Digital Life 101 Challenge
Runner Up in the
Pest Control Challenge
Runner Up in the
Raspberry Pi Contest 2016