So this project came about after a chat at one of the local clubs with a good friend Pete (M0PSX) who runs EssexHam.
He mentioned the idea of building some sort of time out indicator for when you are using a repeater.
Most repeaters have what is called a timeout, this forces people to keep the overs short and ensures good use by everyone on the repeater. If you go over the time out, well the repeater stops retransmitting and no one can hear you. Because you are transmitting, you are unaware of the timeout warning beeps or even that you have timed out…
So started the project…
Now There are many ways you could do this from the obvious.. by a cheap stopwatch or egg timer, or you could build a simple 555 timer circuit to count down from a number of minutes.
That is all fine but you have to remember to start the time at the start of every transmission. Plus different repeaters have different timeouts (Although 2 mins is fairly common)
So the project brief was put together
- Should automatically start the timer when you start your transmission
- Should give a visual and audible indication of the time left
- Should be able to change the timer length easily
This sounds perfect for an Arduino project. using the IFFFT model. As I have a bunch of these laying around at home and all the other components required it was fairly quick and easy to get the working prototype working.
This is a fairly simple Input/Process/Output Block diagram to just give a quick overview. From here we can start to break down each of the blocks
The key to this project is the automatic nature of the timer start. It has to detect the fact that the user has started to transmit and continue to check if the transmitter is still transmitting.
Below you can see a very simple detector circuit which seems to be working well. It combines a working circuit of just 1 diode and 1 M ohm resistor.
There are certainly improvements that can be made but this is fine for testing for now.
Now this project is going to become a series of Arduino kits which will be available to buy from the website soon, with a full set of instructions available too. So a more formal write up of the steps will come shortly.
I decided on using an Arduino for the logic control for a few reasons. Mostly the fact I have dozens of them laying around from various project builds, but also coding in Arduino C is fairly straight forwards and you can build quite complex logic flows quickly with changes easy to apply and retry…
Most basic code for an Arduino consists of 3 sections.
- Defining your variables
- Setup process, where you set your inputs and outputs pins
- The Loop, the logic that is tested over and over whilst the power is applied.
So lets look at each of these in turn.
- Define the Variable.
I like to define each of my pins with a logical name, whilst it is not strictly necessary I find it makes it easy later on in the code to use a pin name rather than a number.
If you wanted to have an LED on pin D3, you can declare the following
#DEFINE LEDPIN 3
Now you can use LEDPIN in your code rather than remembering it was pin number 3. Also if you change the pin number you only have to change the declare statement once at the top of you code, rather than searching all your code for every instance of pin3 and changing it.
The final benefit is that when it comes to wiring up your Ardunio board, especially when doing so on a breadboard or pin board, the declare section at the top of your code acts as a reminder of what component should be connected to which pin.
We can also define some other values we will need in the rest of the code here, it centralises the key values, which the user may wish to change to suit their own needs. Its a bit like a config file but included as a section of the single file program.
Here we need to tell the Arduino what type of variable we want. Some of the options include Integer (Int), Boolean (true or False), String (word or sentence)
In my code I use unsigned Int, this just means it can be a possible number only and can’t have a minus sign at the front, just helps to keep memory usage down.
unsigned int ALERT1 = 30; //How many seconds left for first alert (Amber)
Here we will need to know when the number of seconds left goes below ALERT1 (which in this example is 30) then we do something else. Again this means if you want to change the setting from 30 seconds to 20 seconds, you don’t have to remember where abouts in the code you put that section, rather you just need to look at the first section of your code and change 30 to 20.
2. Set up Routine.
The first routine you always run when using Arduino is called the set up routine.
Within the set up routine we need to tell Arduino how we want to use the pins, either as input or outputs. We do this with the pinMode() command.
For the input we can use one of two types. INPUT or INPUT_PULLUP, the later has an onboard 10k resistor that keeps the voltage at 5V until we short it to ground.
Step 3. The Code.
The main part of our program runs in the LOOP routine.
This part of the Arduino code executes over and over unless we tell it to stop.
It will also run as fast as it can, now this can be of benefit in most cases, but for a simple timer like this we can slow the loop down with a command called delay.
By inserting a 200 millisecond delay in each loop, we can slow the loop down to about 5hz, more than enough for this little program.
Please note this is not the most elegant way of doing this, adding a delay will stop the program for the defined period. During this time it will not be detecting any changes to inputs or be able to do any other logic. A much better way to do this is with interrupts but becomes more complicated, for this simple project the delay step is fine.. Just bear in mind with your own code
So what do we need the loop to do.
Detect if the RF is above the level we set.
If we have detected then start to count down from the timer value
Then if the countdown timer is below our variables we set for each stage of the alert mode. (normal, 1st warning, 2nd warning etc)
Detect the RF Signal as stopped and reset the timer.
Also we need to check if the user has changed the timer selection from 1,2,3 or 4 minutes.
That seems quite a lot to do, but if we break it down into small steps it will be much easier.
More to come……