ultrasonic transmitter circuit

Hi.

I have one of these fireplaces which came with a simple remote control that uses ultrasound transmission to adjust the flame hight.

I am trying to build a thermostat for the fireplace, and need to create a circuit which can send ultrasound at 40.5 kHz (adjust flame up) and 40.0 kHz (adjust flame down).

I have found this schematic (se picture below) to create a circuit for transmitting on 40kHz, but i have two challenges:

  • Can i somehow modify it to use the 5v power from the Arduino, or do i need to use an external 9v battery?
  • Can it be altered so that I can send both 40kHz and 40.5kHz waves? If so, how?

I have a programming background, but i'm totally new to electronics. I would really appreciate any kind of help and tips :slight_smile:

Edit: I understand that i can change the frequency by using the variable resistor, but i would like to change it by chaning which pin on the arduino i sent power from. Example:

pin 3 HIGH = 40kHz
pin 4 HIGH = 40.5 kHz

You can change the frequency, that is what VR1 does.
It trims the frequency to get what you want.
I can't tell if it can do a 1.25 % increase of the frequency, but you can if you build this and test it with your fireplace.

MAS3:
You can change the frequency, that is what VR1 does.
It trims the frequency to get what you want.
I can't tell if it can do a 1.25 % increase of the frequency, but you can if you build this and test it with your fireplace.

Yes, i understand that, but i want to change it by sending the signal from an other pin on the arduino, not by a physical button.

pin 3 HIGH = 40kHz
pin 4 HIGH = 40.5 kHz

Tricky because that circuit uses 9V and the arduino can only handle 5V directly.
You will have to use a PNP transistor to act as a top switch and a NPN transistor to derive the switching voltage ( 0 to 9V) to control the PNP. You need two of these circuits each switching in a pot, which you adjust to get the required frequency. This replaces your switch.

You could generate the 40 or 40.5 kHz signal with the Arduino, and just use the transistors to amplify it for the transducer. The amplifier circuit you posted is not the best, by the way.

Get rid of all that. Use the Arduino to generate the 40kHz or 40.5kHz using something like the tone() library. Drive the ultrasonic transducer with a better driver, that circuit automatically loses about 3V out of 9V, anyway.

Here's one using BJTs to drive a couple of MOSFETs in a configuration that limits shoot-through.

polymorph:
Get rid of all that. Use the Arduino to generate the 40kHz or 40.5kHz using something like the tone() library. Drive the ultrasonic transducer with a better driver, that circuit automatically loses about 3V out of 9V, anyway.

Here's one using BJTs to drive a couple of MOSFETs in a configuration that limits shoot-through.

MOSFETDriver01 - CircuitLab

Thank you so much for this. I have found all the parts i need at farnell, can someone verify that they are correct according to polymorph's circuit?

Ultrasonic Transmitter: partnr 1007332
2N3906: partnr 1574372
2N3904: partnr 9846743
IRF9530: partnr 8648603
IRF530: partnr 8648263
1 uf capacitor: partnr 2112990

Better make that at least 10uF, I had just poked that 1uF in the circuit for a different project. 1uF is almost 4 ohms reactance at 40kHz.

A filter cap made for a switching power supply is good, it will be designed for high frequency and with low ESR.

100uF 63V ESR less than 2mOhm:

Those are not the right MOSFETs, they require at least 10V. You need something called Logic Level MOSFETs that are rated at full ON at 4.5V.

It is the parameter entitled "Rds(on) Test Voltage Vgs".

P channel, 4.5V Rds(on):

N channel, 4V:
http://uk.farnell.com/fairchild-semiconductor/fdp65n06/n-channel-mosfet-60v-65a-to-220/dp/2118346

The BJTs you've selected should be fine.

Thank you so much for your help [user]polymorph[/user].

I tried to build the circuit with the parts you specified, and i am able to create the 40kHz signal using tone(myPin, 40000), but i cant get it to play 40500 hertz. I've tried all the frequencies between 39000 and 42000, but only 40000 is working. (i don't have a oscilloscope, so i can only test by seeing how my receiver responds).

Is the circuit correctly put together? Btw, i did not find a ultrasonic transmitter in Fritzing, so i used a pushbutton.

I used this MOSFETDriver01 - CircuitLab as a reference.

Thanks for any help :slight_smile:

OK, great, so we know the circuit is working, because 40kHz will trigger the receiver.

Can you post your code? Don't forget to use the code tags.

Do you own the fireplace?

I mean - if you do - why are trying to figure out the ultrasonic portion at all? Instead, insert (not literally - you'll likely need to make some level conversion system) your Arduino between the output of the receiver and the valve.

That way, when you use your remote control, the Arduino can simply pass-thru the values to the valve - or you can use the valve directly via the Arduino. The valve could be anything; you would need to figure out where and how it is actuated, then take some measurements to determine what the receiver is sending (and/or receiving - in case it is some kind of servo-actuated valve - and by "servo" I don't necessarily mean an RC servo!).

Likely far easier to do this than to fake the ultrasonic transmitter (which, as you have found, is not easy without access to an oscilloscope).

polymorph:
OK, great, so we know the circuit is working, because 40kHz will trigger the receiver.

Can you post your code? Don't forget to use the code tags.

ive tried different stuff, something like

long hertz;
int pinId;

void setup() {
   Serial.begin(9600);
   hertz = 39000;
   pinId = 5;
}
void loop() {
   tone(pinId, hertz);
   Serial.println(hertz);
   hertz += 10;
   delay(1000);
}

By using this code, the fireplace reacts on hertz 39980 - 40020, where the fire is turned down. It does not react on any other frequences.

By using a hc-sr04 distance sensor, i was able to turn the flame both ut and down using the same code. But it was really unreliable.

This may sound strange, but try connecting a 100 ohm resistor in parallel with the ultrasonic transducer.

Nordbo, did polymorph's suggestion help in the end? My parents have recently got the same fireplace and I'd like to help them control it from their smartphones. Did you manage to get the 40.5khz signal working in the end?

Hi Burntfaceman,

I'm just looking into this myself, as the remote for our fireplace has stopped working. I'm pretty sure the ultrasonic transmitter was broken when the remote was dropped. It will work if I hold it less than an inch from the receiver, but otherwise doesn't work.

I am considering replacing the ultrasonic reciever and motor driver circuit with an arduino or Spark Core (Particle Photon). One issue for me so far, is that the existing system is battery powered and there's no power immediately by the fireplace, so I want to make something that will have long battery life, and so a wifi option might not be the best bet.

There are only four wires from gas valve to the controller: Two drive the motor up and down, and two connect to a microswitch on the dial to relay the upper and lower limits of the motor to ensure the motor stops when it needs to.

Thanks,

Nathan

Hi polymorth,

Could I pick your brain please?

I've built your circuit but the mosfet FDP65N06 gets really hot, changing color and smelling burnt. I've checked the connections but everything seems ok.

Any ideas?

By the way, the sketch below gives me the right frequency for the ultrasonic transduver:

/*
Arduino UNO DDS
Arduino Square Wave Generator (UNO - Mega - Pro.Mini)

Frequency Range : 1Hz to 1Mhz
Duty Cycle : 2% - 98%
Pins Out : 3 - 9

*/

#include <PWM.h>

int32_t frequency_9 = 58000; //frequency (in Hz)
int32_t frequency_3 = 58000; //frequency (in Hz)

void setup()
{

InitTimersSafe();

SetPinFrequencySafe(9, frequency_9);
SetPinFrequencySafe(3, frequency_3);

}

void loop()
{

int dutyC =512; // Duty Cycle 0 (0%) - 1023(100%)
pwmWrite(9, dutyC / 4);
pwmWrite(3, dutyC / 4);
delay(30);

}

Thank you!

Hi all,

I've just purchased one of these fireplaces that has one of these remote controls

This is literally the only place on the internet I've found any information about being able to automate the use of one of these controls!

So, with next to no circuitry experience and zero Arduino experience can anyone give me a n00bs guide to building this?!

I'm really into automating my home so getting this working with my Athom Homey and/or Alexa is my ultimate goal.

Many thanks

I know this is quite an old thread but I am very grateful as it was a really great help to me so I wanted to add my results in case anyone is also struggling. I have the same fireplace and mine has a badge Mertik (Maxitrol) on the controller. The fire is in fact designed to be used with the pilot light always on, so automating the up/down control is not a big issue I would say.
Anyhow in the end I have connected it up to Alexa using a photon particle and coded a simple timer sequence with an analogue write (PWM) routine with 50% duty and 40/40.5khz frequency (8 bit resolution). The particle is then very easy to set up with event handlers and link through IFTTT to Alexa or your phone via particle publish triggers/webhooks. I guess the Arduino with a specific shield can be used, but I never tried that. For the driver I push the particle output through a full H bridge using a pair of BJT 2N3904 and 2N3906 with bases coupled together via 2 x 1k resistors and fed with a single common output from a particle IO pin (PWM). With Vcc @ 5V I get about 8.5v peak-peak across the transducer. I use a 5th BJT (2N3904) with 2k into the base and the collector is tied to vcc via 100ohm essentially inverting the input operation one side of the bridge. I did take apart the controller and put a scope on it to check the waveforms etc and then I did a quick LTspice simulation of the bridge, but I was not very sure about the transducer response attributes until I tried it, but in fact it works very well. You do seem to need quite high peak-peak to get this working over a distance (12ft in my case) and especially when the metal cover surround is on the fire. The real controller is 9v battery driven with a crystal oscillator and decade/divider counters to reduce the clocking down to 40/40.5khz and the peak-peak is almost at limits of the transducer (20v pk-pk) so is a very 'strong' signal.
Of course the bridge is currently always 'on' with my single PWM pin control and I simply set to 0% duty after 3-4 seconds after running the function call for up/down. I guess I could play around and implement better bridge control (with a brake state) with multiple inputs, but I think I may just stick with this solution for the moment while I am still testing the stability and perhaps put a relay control for Vcc and activate this first in the routine. Anyway, many thanks again for this thread which pushed me firmly in the right direction. As a comment, I did try initially with a 555 timer but the stability was simply not good enough and I gave up after very poor results (it sort of worked but very intermittent). Lots and lots of ways of doing this but I already had the particle hooked up as an Alexa driven IR transmitter for the TV and Virgin box, wifi bulbs (and some IR remote candles) so it was a bonus to be able to finally add the fireplace control just for the cost of a few cheap components and a few lines of code. The front room can be now set up with a single Alexa command! Final goal achieved! ;o)

MTB2019:
I know this is quite an old thread but I am very grateful as it was a really great help to me so I wanted to add my results in case anyone is also struggling. I have the same fireplace and mine has a badge Mertik (Maxitrol) on the controller. The fire is in fact designed to be used with the pilot light always on, so automating the up/down control is not a big issue I would say.
Anyhow in the end I have connected it up to Alexa using a photon particle and coded a simple timer sequence with an analogue write (PWM) routine with 50% duty and 40/40.5khz frequency (8 bit resolution). The particle is then very easy to set up with event handlers and link through IFTTT to Alexa or your phone via particle publish triggers/webhooks. I guess the Arduino with a specific shield can be used, but I never tried that. For the driver I push the particle output through a full H bridge using a pair of BJT 2N3904 and 2N3906 with bases coupled together via 2 x 1k resistors and fed with a single common output from a particle IO pin (PWM). With Vcc @ 5V I get about 8.5v peak-peak across the transducer. I use a 5th BJT (2N3904) with 2k into the base and the collector is tied to vcc via 100ohm essentially inverting the input operation one side of the bridge. I did take apart the controller and put a scope on it to check the waveforms etc and then I did a quick LTspice simulation of the bridge, but I was not very sure about the transducer response attributes until I tried it, but in fact it works very well. You do seem to need quite high peak-peak to get this working over a distance (12ft in my case) and especially when the metal cover surround is on the fire. The real controller is 9v battery driven with a crystal oscillator and decade/divider counters to reduce the clocking down to 40/40.5khz and the peak-peak is almost at limits of the transducer (20v pk-pk) so is a very 'strong' signal.
Of course the bridge is currently always 'on' with my single PWM pin control and I simply set to 0% duty after 3-4 seconds after running the function call for up/down. I guess I could play around and implement better bridge control (with a brake state) with multiple inputs, but I think I may just stick with this solution for the moment while I am still testing the stability and perhaps put a relay control for Vcc and activate this first in the routine. Anyway, many thanks again for this thread which pushed me firmly in the right direction. As a comment, I did try initially with a 555 timer but the stability was simply not good enough and I gave up after very poor results (it sort of worked but very intermittent). Lots and lots of ways of doing this but I already had the particle hooked up as an Alexa driven IR transmitter for the TV and Virgin box, wifi bulbs (and some IR remote candles) so it was a bonus to be able to finally add the fireplace control just for the cost of a few cheap components and a few lines of code. The front room can be now set up with a single Alexa command! Final goal achieved! ;o)

Thanks for the response - hoping you can help me break this down...

I REALLY want this working with Alexa, so could you please break down the items you purchased for me? Looks like you're in the UK like me so seems that everything you've used is available locally...