Hi,
I'm still experimenting around with these DRA818V FM Transceiver modules - specifically I'm having some difficulty trying to put it to sleep and wake it up again. I'm hoping someone with some experience can put me right.
A Brief Explanation of What I'm Trying to Achieve:-
I have a simple circuit I am experimenting with on a breadboard. It comprises of an Atmega 328P-PU running at 8Mhz Internal (with 8s Sleep Mode) and a DRA818V by way of a homemade breakout shield - all of which are running at 3.3V which is supplied via an LM2596 DC Converter which is in turn connected to a 12V battery. I have drawn a quick and dirty schematic for ease. I did not include the DC converter or the Battery. Just the main components.
The DRA818V currently has 3 connections to the Atmega.
- Hardware Serial TX Pin from Atmega to DRA818V RX Pin
- D7 from Atmega to Power Down Pin on DRA818V
- D8 from Atmega to PTT Pin on DRA818V
I've not added any audio in that schematic yet because I am trying to get the circuit to run as low powered as I can before proceeding but I'm having issues with putting the DRA module to sleep and waking it up again.
I am using this library GitHub - darksidelemm/dra818: DRA818U/V Radio Module Arduino Library and the example code that comes with it and that works just fine as is.
#include "DRA818.h"
DRA818 dra(&Serial, PTT);
void setup(){
// Initialise our Serial interface.
Serial.begin(9600);
// Now we configure the DRA818
pinMode(PD, OUTPUT);
digitalWrite(PD, HIGH);
// The following functions are not instantaneously set, you need to call writeFreq to program them.
dra.setFreq(146.525);
dra.setTXCTCSS(9); // 9 = 91.5 Hz, See https://en.wikipedia.org/wiki/CTCSS for a list.
dra.setSquelch(3); // Squelch level 3.
dra.setRXCTCSS(0); // No CTCSS on RX.
dra.writeFreq(); // Write out frequency settings to the DRA module.
// These functions are instantaneously written to the DRA module.
dra.setVolume(4); // Set output volume to '4'.
dra.setFilters(true, true, true); // Sets all filters (Pre/De-Emphasis, High-Pass, Low-Pass) on.
}
void loop(){
// Key the PTT on and off repeatedly.
digitalWrite(PTT, LOW); // PTT is Active low, so this turns the PTT on.
delay(1000);
digitalWrite(PTT, HIGH); // PTT off.
delay(1000);
}
But as soon as I edit this code to try to get it to power down the module, things go pear shaped....
What I've Tried and the Results I've been Getting:-
The sequence of events I am trying to get from when I first power up the circuit with 3.3V is this:-
- Power Up with 3.3V
- DRA818V Powers Up
- Setup() -> PTT PIN HIGH, DRA Power Down HIGH (Awake) -> Program DRA818 -> DRA Power Down LOW (Sleep)
- Loop() -> DRA Power Down HIGH (Awake) -> DRA PTT LOW (TX) -> Wait -> DRA PTT HIGH (RX) -> DRA Power Down LOW (Seep)
I've tried all kinds of ways I can think of to get that sequence to happen but something always goes wrong.
The typical result I get from editing that sketch / code and adding the power down, power up stuff is that the program will run once and transmit but then never again.
But interestingly, if I don't ever write the PTT pin HIGH but just power down the DRA in the loop, then the result I get is the opposite. The DRA doesn't do anything the first time round the loop but will run every time after. I am getting some right strange things happen.
I've tried using pull up resistors, pull down resistors, playing around with the starting state of the pins in Setup().. I just cannot get that sequence of events to happen. I either get it to run just once or I get it where it wont run the first time round the loop but will run every other time.
Also concerning me in my hunt for low power is the fact that the Atmega has to hold the PTT pin in a HIGH state constantly and that will be drawing a load I presume? So I need an efficient way of handling that which I've not yet figured out.
My circuit is taking roughly 30mA from the battery with the DRA module powered up all the while and the PTT pin held high. I would like to get that down to as little as possible but I'm not sure how to achieve it.
Incidentally, I didn't include any pull up, pull down or current limiting resistors in the schematic above simply because I've tried all sorts of values and combinations and haven't found any that helped...
I have literally been battling this for days on end and all my searches end up back where I started. I was hoping to beat this on my own but I have to admit defeat and reach out for some help / guidance.
Maybe a fresh brain or two will see what I'm not seeing.
Thanks!