Question on using a current sense transformer. -> went to a BLE beacon / battery

Thread Starter

Raymond Genovese

Joined Mar 5, 2016
1,653
I remember that some time ago, I used a current sensing relay (something like this one https://www.supplyhouse.com/Aprilai...MIoLy-4pyo2gIVC49pCh3BlAoIEAQYASABEgJXJvD_BwE

) to connect a humidifier on a home furnace only when the blower motor was operating. The device was a non-contact relay that would operate when the blower motor was on. It worked fine.

I am wondering if I can use the same idea for a different project. What I would like to do is have a device that will turn on when a similar blower motor is running (and without directly making an electrical connection to the device).

So, for example, can I clip this device https://www.amazon.com/dp/B075541WV...olid=2SOSZ9TS640JF&psc=0&ref_=lv_ov_lig_dp_it around the AC wires to the blower motor and get, as an output, an AC signal that can be rectified and regulated to power a small embedded controller? What about if the AC wires to the blower motor have shielding? What does the 100A/50mA figure for the device mean?

Alternatively, but not preferred, would be to use the transformer to generate a signal that would be used (wake up or transistor switch) to power up the embedded controller device (which would be operated by a battery for example).

I know very little about these AC Current Sensor Transformer devices. Is this feasible and if so, how can I estimate how much current I can get out? In the original case, there was enough to operate a relay which suggests that 10-15 mA is not unreasonable.

Any beginner-level advice?
 

MrAl

Joined Jun 17, 2014
11,480
Hello,

100A/50ma means you get 50ma out with 100 amps input. That means with 10 amp input you get 5ma output.
At 1 amp input you get 500ua output but that's assuming it is perfectly linear.

That also means that if you want a voltage you have to use what they call a "burden" resistor. This resistor takes that 5ma (10amp input) and converts it into a voltage you can read with say an arduino. 5ma and 1k makes 5v so that would be detected by the microcontroller.

Of course that's with 10 amps input, and so if the input goes up to 20 amps then you get 10v out, so you need to clamp the output also. Maybe a zener for example.

You also need to rectify it which makes it a little more non linear. If the output is center tapped (CT's often are) you can use just two diodes but if not maybe a bridge rectifier.

The choice of resistor depends on what current level you are trying to sense. You may want to mention the current of the blower motor.

You may also find current sense transformers that are more sensitive, like 10A/50ma for example. If you can wind TWO turns of your blower motor wire around the core though, then you will get more sensitivity. Two turns will look like twice as much input current, so you will turn it into a 50A/50ma CT (1ma/amp). Four turns and it will become 25A/50ma CT, which is the same as 2ma per amp.

Also remember that you have to clamp that thing around ONE wire of the blower motor only, not both wires.

There are also types that have the resistor built in. They will have specs like 20A/1v which means you get 1v out when there is 20 amps through the one wire through the core. With two wires, you would get 2v at 20 amps or 1v at 10 amps. You probably want a higher output than that, but then again if you have an analog input channel available you can monitor with that, after rectification perhaps.

There are several ways to do this as you can see.
 
Last edited:

ebeowulf17

Joined Aug 12, 2014
3,307
What about if the AC wires to the blower motor have shielding?
Current transformers must be around just one of the conductors (line or neutral, doesn't really matter which one,) but not both. If a CT is placed around both, the current moving one direction in the line and the current moving the opposite direction in the neutral cancel out, and the CT senses basically nothing.

As such, whether the cable is shielded or not doesn't really matter, because you'll have to separate the conductors anyway, regardless of whether or not there was shielding around them.

As for how much power you can extract from it, that's a function of how much current your blower is drawing, as described by @MrAl above.

EDIT:
Oops! A lot of what I just wrote was redundant. I didn't see that he also mentioned running only one wire through the CT. One final note - if you can't find a CT with the turns ratio you need, you can loop the blower wire through the CT two or more times to get more output current.
 

Thread Starter

Raymond Genovese

Joined Mar 5, 2016
1,653
Good information @MrAl and @ebeowulf17 - I appreciate it.

I was hoping that is what 100A/50mA means.

But, with the other information that you have provided, I have moved the item I mentioned out of my shopping basket and onto my list. I need to do some more thinking before acting.

What I am thinking about building is a device that will automatically turn up the volume on a nearby TV when the blower comes on and turn it back down when it goes off.

The sensor and IR programming parts are not difficult as I have done those before. I have already considered sensing when the blower comes on by vibration or sound or even by a sail switch in the vent.

The current sense transformer came to mind this morning as I recalled my experience with the device I mentioned. The advantage *if* it could provide its own power, so to speak, would be to eliminate the need to power a transmitter that would signal the IR controller.

There are lots of options.

Thanks for the info.
 
Last edited:

MisterBill2

Joined Jan 23, 2018
18,506
I would instead suggest an extension speaker closer to your listening location. But for the current sensing function, I have seen such devices that are fairly small and operate with a 24 volt ac supply and some of them even have contacts that operate when a current above some level is sensed. The sad part is the sensor modules were about$120 (USD) 3 years ago. You might find a better price, but is it worth it??
 

MrAl

Joined Jun 17, 2014
11,480
Good information @MrAl and @ebeowulf17 - I appreciate it.

I was hoping that is what 100A/50mA means.

But, with the other information that you have provided, I have moved the item I mentioned out of my shopping basket and onto my list. I need to do some more thinking before acting.

What I am thinking about building is a device that will automatically turn up the volume on a nearby TV when the blower comes on and turn it back down when it goes off.

The sensor and IR programming parts are not difficult as I have done those before. I have already considered sensing when the blower comes on by vibration or sound or even by a sail switch in the vent.

The current sense transformer came to mind this morning as I recalled my experience with the device I mentioned. The advantage *if* it could provide its own power, so to speak, would be to eliminate the need to power a transmitter that would signal the IR controller.

There are lots of options.

Thanks for the info.
Hello again,

Not sure if you can power a transmitter with a current transformer. With very very low power maybe.

You did not say what your blower motor takes as to the current draw, which is important to know.
 

MisterBill2

Joined Jan 23, 2018
18,506
You could use a relay operated by the current transformer to bypass a low-value variable resistor in the speaker lead of the TV set. That would allow the sound level to jump up to whatever you had the main volume control set at, and when the blower switched off it would drop to the level determined by the additional series resistor. The benefit would be no messing with the remote, since TV remotes are quite delicate inside. Also, not much complexity at all, and nothing that needed batteries. You might even be able to make a current sensor with a few turns of wire around a reed switch. That could be really cheap.
 

Thread Starter

Raymond Genovese

Joined Mar 5, 2016
1,653
Hello again,

Not sure if you can power a transmitter with a current transformer. With very very low power maybe.

You did not say what your blower motor takes as to the current draw, which is important to know.
Yeah, as I suggested, I am kind of cooling on the current transformer approach. I don't know the current of the blower, maybe 3A, maybe a bit more - I don't know as I haven't gone inside and seen what it says.

I think it would have been ideal to be able to have powered the transmitter from a current transformer, but as you have already stated, it may not work out and it would require some additions.

It does not have to power the transmitter, however, as there should be enough current/voltage available to act as a switch. Even so, the current transformer may not be worth the expense and trouble. A simple sail switch in the airflow path could probably work well to switch a battery powered transmitter on and off.

The transmitter I have in mind is a BLE beacon. These can be very low power devices and I think I have one around here that works for months on a 3V coin cell. Of course, broadcast frequency can be an issue, but if it broadcasts on power up, which is likely I think, then that part may be fine. If I really wanted to go to town, I could program a beacon with a desired frequency (when I say broadcast frequency, I don't mean 2.4MHz, I mean the frequency of transmitter activation). Certainly the 3V coin cell can be replaced with a higher capacity rechargeable battery.

On the receiver side, power is not a problem since that device would be situated near the TV where there are plenty of plugs. It would be looking for the beacon signal all the time until it found it. Then it cranks out an IR transmitter to up the volume for as long as it sees the beacon signal, dropping the volume back down when it is gone.

Of course, other transmitters are possible and they would take more power, but, they are not operating 24/7 and don't have to go far.

We'll see, it is just a project idea that I am playing with and I don't know what if anything will come of it. Fun to think about an I appreciate your thoughts on the matter.
 

Thread Starter

Raymond Genovese

Joined Mar 5, 2016
1,653
You could use a relay operated by the current transformer to bypass a low-value variable resistor in the speaker lead of the TV set. That would allow the sound level to jump up to whatever you had the main volume control set at, and when the blower switched off it would drop to the level determined by the additional series resistor. The benefit would be no messing with the remote, since TV remotes are quite delicate inside. Also, not much complexity at all, and nothing that needed batteries. You might even be able to make a current sensor with a few turns of wire around a reed switch. That could be really cheap.
An interesting approach that I had not thought about at all. IOW, attenuate the volume to the speaker and then remove the attenuation when the blower is operating. Cool thinking.

On the other hand, I am not looking to go inside the TV, or go inside the remote for that matter. I will use a micro to clone the remote signals for volume up and volume down and it will broadcast them to the TV using an IR emitter.
 

Thread Starter

Raymond Genovese

Joined Mar 5, 2016
1,653
I would instead suggest an extension speaker closer to your listening location. But for the current sensing function, I have seen such devices that are fairly small and operate with a 24 volt ac supply and some of them even have contacts that operate when a current above some level is sensed. The sad part is the sensor modules were about$120 (USD) 3 years ago. You might find a better price, but is it worth it??
Yeah, I am familiar with those (although not a current sensing one, but it had its own amplifier and volume knob) and set one up for a relative with hearing difficulty - whose wife was extremely appreciative since he previously had the TV volume so high, she couldn't enjoy being in the same room. Using the satellite speaker, which was situated right at his sweet spot, solved the problem.

This is a little different situation though.
 

Reloadron

Joined Jan 15, 2015
7,517
These little Low Cost Remote Current Indicators were about $10 USD, they apparently went up to about $13 USD. They turn on at about 1.5 Amps AC and use a bi-polar LED. You could likely use one in conjunction with a photocell to turn on a relay. I have also looped the current carrying conductor through them twice to get the turn on down to about 0.75 AAC. As to off the shelf turn key solutions a Google of "current sensing relay" should bring up some solutions.

Ron
 

MrAl

Joined Jun 17, 2014
11,480
Yeah, as I suggested, I am kind of cooling on the current transformer approach. I don't know the current of the blower, maybe 3A, maybe a bit more - I don't know as I haven't gone inside and seen what it says.

I think it would have been ideal to be able to have powered the transmitter from a current transformer, but as you have already stated, it may not work out and it would require some additions.

It does not have to power the transmitter, however, as there should be enough current/voltage available to act as a switch. Even so, the current transformer may not be worth the expense and trouble. A simple sail switch in the airflow path could probably work well to switch a battery powered transmitter on and off.

The transmitter I have in mind is a BLE beacon. These can be very low power devices and I think I have one around here that works for months on a 3V coin cell. Of course, broadcast frequency can be an issue, but if it broadcasts on power up, which is likely I think, then that part may be fine. If I really wanted to go to town, I could program a beacon with a desired frequency (when I say broadcast frequency, I don't mean 2.4MHz, I mean the frequency of transmitter activation). Certainly the 3V coin cell can be replaced with a higher capacity rechargeable battery.

On the receiver side, power is not a problem since that device would be situated near the TV where there are plenty of plugs. It would be looking for the beacon signal all the time until it found it. Then it cranks out an IR transmitter to up the volume for as long as it sees the beacon signal, dropping the volume back down when it is gone.

Of course, other transmitters are possible and they would take more power, but, they are not operating 24/7 and don't have to go far.

We'll see, it is just a project idea that I am playing with and I don't know what if anything will come of it. Fun to think about an I appreciate your thoughts on the matter.
Hi again,

If you have an old 3v to 24vdc wall wart around (many do) you can make your own current transformer. In fact just about any will do except the 'regulated' type which are light weight. The old heavy ones will work though.
These have a transformer and rectifier and filter cap inside.
If you cut apart the plastic (carefully with a Dremel tool and cutter) you can get the transformer core out. You can then fish ONE turn of wire through the core (or maybe two turns) and use the PRIMARY as the secondary of the current transformer. Of course a burden resistor is still required across the 'new' secondary.
The ratio might be around 1:300 but you could check that. With 10 amps you can get around 3v out for example.

3 Amps (for the blower motor) isnt a lot. A typical 1:1000 current transformer will only give you 300ua out.
There are Hall Effect sensors that might work better here. They also provide isolation like a current transformer, but require a small power supply like 5v at maybe 20ma.

Seems to me though that if the blower motor comes on then there must be a switch that turns the power on. You could simply detect power to the motor (voltage) and for that you could use a regular wall wart for example and use the output to tell your transmitter to turn one, or just use it to power the transmitter.

Broadcast band transmitters usually dont go very far. That would mean that you probably would not interfere with any body else's radio. Turn to one end of the band where there is never any station broadcasting.

Someone else mentioned a relay. That is also a simple solution. If you get one with 120vac coil it will come on when the blower comes on.
 

Thread Starter

Raymond Genovese

Joined Mar 5, 2016
1,653
I have continued some work on this project. I settled on an approach that strives to use non-invasive techniques and one that uses, as much as possible, components that I already have on hand. This is where I am at currently, with some degree of success but with challenges remaining.

I decided to proceed by first developing the capability to send IR signals to the TV to raise and lower the volume. I can do that now, but it is not as precise as I would like.

I am using an Arduino Pro 3.3V clone - I purchased a couple of these for ~$1.50 w/free shipping off of “ChinaBay” e.g., https://www.ebay.com/itm/Pro-Mini-a...176453&hash=item441c1d4ca8:g:ph0AAOSwNSxU~k2b and I see that the price has gone up a bit. They work.

After looking into a couple of IR libraries, I chose to use IRLib2 https://github.com/cyborg5/IRLib2/blob/master/IRLib2

The IR LEDs are from my parts bin and I have no idea what their specifications are or when/where I got them from. I have tried using one with the Pro Mini 3.3V and they work alright when driven at 33 mA directly by a GPIO using a 100 ohm current limiting resistor. I have settled, right now, on using two and an NPN (C945) transistor that is turned on by the GPIO port and sends about 50 mA through each LED. This also works and is some improvement in performance compared to using a single LED. The IR signals, however, are meant to be sent only a few inches from the set, so it is not a big distance issue.

Encoding the signal was/is a bit of a challenge. Repeating remote buttons, like Vol Up/Vol Down are handled differently by different formats. I had been using the NEC format (I don't know if it was version 1 or 2) but after some frustration I decided to use a different approach. I ended up getting a raw reading from the Vizio remote using IRrepeator https://github.com/smallbeetw/arduinosketch/blob/master/IRrepeator/IRrepeator.ino and then shaping the signals using timing targets of 560/4500/1690/9000).


I send discrete Vol Up/Vol Down commands repeatedly rather than a single Vol Up followed by the repeat code, which I could never seem to get to work. The raw send technique works, but it is not ideal.


When I send the raw codes to the TV eight times, for example, the volume will be raised (or lowered) 6-7 notches. I have varied the timing between codes but I can't get the exact number of notches expected. It is not optimal, but the variability is not biased toward either Vol Up or Vol Down, so it may be acceptable.

To detect when the blower is on, I rigged (and I do mean rigged) a home-made sail switch. I could not find a tiny micro switch with a lever arm in my parts, but I did have a sub miniature micro switch and I basically built an arm and sail. These are attached to one of the two mounting holes on the switch, but are freely moving. The other mounting hole on the switch is used to attach the rig onto a piece of aluminum. I placed a square sheet of Mylar (maybe 2 X 2 inches) on the arm to act as the sail. The whole unit fits over the air filter and is placed inside the blower intake chamber. It does work; although it looks like a child made it (I clearly lack skill at making these types of items). At this point, I had the means to turn something on that could tell the controller that the blower was running.


I had an old BLE "Beacon" - something like this one https://www.hackster.io/bigboystoys13/diymall-bluetooth-beacon-getting-started-656c6b. These are a stripped down version of a BLE device sold as an “HM-Sensor”. They are really not Beacons at all, but connectable BLE peripheral devices and they were designed to contain a DS temperature sensor and some other capabilities.


See the TX and RX connections in the link photo? They are not connected to anything on the stripped down version. That means you can’t program them by attaching them directly to a serial port on a controller.

Eventually, I figured out that these are the usual HM-10/11 type devices, but this one can only be configured by connecting to it and manually sending the AT Commands (I used the old standby nRF Connect / nRF Master Control Panel). All I really needed to do was to confirm the MAC address and set the advertising interval to 100 ms, which was easily accomplished once I figured out how to communicate with the board.

With some de-soldering/re-soldering, I intercepted one of the leads on the coin battery holder so that board would only be powered when the micro switch was closed (i.e., when the blower was running).

The last step was to interface another HM-11 board to the Arduino and I had one of those like this one https://www.seeedstudio.com/Grove-BLE-p-1929.html I have used these (HM-10/11) boards before. They do work, but they can be extremely limited.

In this case, I configured it as a central device and I simply request scans of whatever BLE devices are out there. The scan results are returned as a long string with the length depending on how many devices are visible. I simply search for the MAC address of my device. This works fine, but it takes a couple of seconds to read the string. This is not because the Arduino is slow, it is because (I believe) that the characters are sent to the serial port at an intermittent speed such that you can have a pause in between characters and I have to wait for characters for a set amount of time to make sure I get the entire string. If it messes up at this point, I can get partial strings and software serial overflow errors. Still, it is not an insurmountable problem, but I may work on reading the string more efficiently.

That's where I am at now, everything is rigged and bread-boarded and being tested. It does, in fact, appear to work! Everything used was components that I had on hand.

We will see how long the BLE battery lasts. I can slap a rechargeable 3.6V battery on there or three rechargeable AAAs as alternatives. But, I have a bunch of old CR2025s and I would be happy if I could get a month or so out of each one.

I also plan on seeing if I can get the IR signals to send commands to effect exact Vol Up/Vol Down notches. If I go further, I will also definitely have to rebuild the sail switch and maybe buy a micro switch with a lever arm attached to start with.

With all of these challenges, my feeling at this point is “so far so good”.


There are many different ways to go about this task, but I like the idea of using a BLE beacon as a simple local transmitter for control. I really need to see about making a little board using an "easy" chip - maybe a BM70 or something like that...but that is another project.


Edited for clarity and readability.
 
Last edited:

Thread Starter

Raymond Genovese

Joined Mar 5, 2016
1,653
Update:

I continued to use the device and it worked quite well. I left it on the breadboard as I stated and I am trying to stop doing that. So, I took another look at things. Revised the sail switch a bit and then decided it was time for this breadboard mess to go:
autovol1 IMG_0307.jpg

I dumped the HM-11 and the Arduino. Used a Linkit 7697. I have good things to say about this board. I found it at least as easy to do BLE as the ESP32 and, of course, it can be programmed as either a peripheral or central device. As usual, you have to wade through the appropriate .h and .c firmware files, but I am used to that.

Linkit IMG_8957r.jpg

I used an old combo box with circuit board so all I had to do was drill two holes; one for the USB wart PS slot and one for the IR LED hole - I managed to do both effectively. The schematic is even simpler than the first version.
autovolSchem.jpg

The code was streamlined and easily adapted to the Linkit.
C:
// ******************************************************************************
// LinkitBeaconVolControl v1.0 by DrG  **
// Project code to send a Volume Up signal to the TV remote when a Linkit 7697 **
// detects the presence of a beacon that is powered on by a sail switch that  **
// reacts to the blower motor of the (loud) HVAC unit.  **
//  **
// This software is offered strictly as is with no warranties whatsoever.  **
// Use it at your own risk.  **
// ******************************************************************************
//
// Uses Arduino IDE 1.8.7 and Linkit 7697
// IR LED operates from P3 with a 1k resistor to the base of a 2N4401 and
// a 82 ohm resistor driving a LED 55b IR LED (3.3V, ~40mA, .013 W)
// ******************************************************************************

// includes
#include <LBLE.h>
#include <LBLECentral.h>
#include <IRremote.h> // note: this library is in the Linkit board dir

// prototypes
bool ScanForTarget();
void VolUp(int steps);
void VolDown(int steps);

// defines
#define SCANTIME 2000 // scan duration (ms)
#define DATA_LEN 68  // hard coded array length
#define STEPS 9  // how many notches up or down (+/-1 in practice)
#define DelTime 100  // ms delay after each IR command
#define kHz 38  // carrier frequency
//#define DEBUG  // comment out for no serial port output

// globals
// the address String returned by LBLE.getAddress() for the beacon
String target = "20:91:48:4C:5B:5A(PUB)";
byte state = 0;  // track state =1 beacon on / 0 beacon off
int x;  // utility counter

//  Raw codes for Vizio remote were initially read using IRrepeater.ino
//  https://github.com/smallbeetw/arduinosketch/blob/master/IRrepeator/IRrepeator.ino
//  and the values were smoothed to 560/1690/4500/9000 to make this code data
unsigned int VolUpCmd[DATA_LEN] = {9000, 4500, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560};
unsigned int VolDownCmd[DATA_LEN] = {9000, 4500, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560};

IRsend mySender;
// ******************************************************************************
bool ScanForTarget() {
  // return true if target address is found in a scan
  byte returnval = 0;
  int ndevices = 0;

  LBLECentral.scan();
  delay(SCANTIME);
  ndevices = LBLECentral.getPeripheralCount();
  // go through the device list
  if (ndevices > 0) {
  for (x = 0; x < ndevices; ++x) {
  if (LBLECentral.getAddress(x) == target) {
#ifdef DEBUG
  Serial.println("  Target Found !");
  Serial.println(LBLECentral.getAddress(x));
#endif
  returnval = 1;
  break; // we don't need the rest of them
  }
  }
  }
  LBLECentral.stopScan();
  return (returnval);
}
// ******************************************************************************
void VolUp(int steps) {
  digitalWrite(LED_BUILTIN, HIGH);  // use board LED for feedback
  for (x = 0; x < steps; x++) {
  mySender.sendRaw(VolUpCmd, DATA_LEN, kHz); // array,length,frequency kHz
  delay(DelTime);
  }
  digitalWrite(LED_BUILTIN, LOW);
}
// ******************************************************************************
void VolDown(int steps) {
  digitalWrite(LED_BUILTIN, HIGH);  // use board LED for feedback
  for (x = 0; x < steps; x++) {
  mySender.sendRaw(VolDownCmd, DATA_LEN, kHz); // array,length,frequency kHz
  delay(DelTime);
  }
  digitalWrite(LED_BUILTIN, LOW);
}
// ******************************************************************************
void setup() {
  pinMode(LED_BUILTIN, OUTPUT); // init board LED (pb7 for linkit)
#ifdef DEBUG
  // Open serial communications
  Serial.begin(9600);
  Serial.println("LinkitBeaconVolControl v1.0");
  Serial.println("BLE begin");
#endif
  digitalWrite(LED_BUILTIN, HIGH); // use LED for error detection (remains on)
  // Initialize BLE subsystem
  LBLE.begin();
  while (!LBLE.ready()) {
  delay(10);
  }
  digitalWrite(LED_BUILTIN, LOW);
#ifdef DEBUG
  Serial.println("BLE ready");
#endif
}
// ******************************************************************************
void loop() {
  // Tracks the beacon appearance and turns Vol up and down
  if (ScanForTarget()) { //returns true if found
  if (state == 0) { // if new power up- vol up & change state / else ignore
  VolUp(STEPS);
  state = 1;
  }
  }
  else {  // no beacon found
  if (state == 1) { // if new power down- vol down & change state / else ignore
  VolDown(STEPS);
  state = 0;
  }
  }
}
// END **************************************************************************
Since I already had the raw codes for volume control, I did it that way, but the Linkit has an IrDA peripheral and I probably should learn how to use that if I do anymore IR stuff.

The only other thing I am considering is to dump the sail switch and battery and use one of these to generate the power for the beacon.
autovol2 IMG_0311.jpg
 

ebeowulf17

Joined Aug 12, 2014
3,307
Update:

I continued to use the device and it worked quite well. I left it on the breadboard as I stated and I am trying to stop doing that. So, I took another look at things. Revised the sail switch a bit and then decided it was time for this breadboard mess to go:
View attachment 175673

I dumped the HM-11 and the Arduino. Used a Linkit 7697. I have good things to say about this board. I found it at least as easy to do BLE as the ESP32 and, of course, it can be programmed as either a peripheral or central device. As usual, you have to wade through the appropriate .h and .c firmware files, but I am used to that.

View attachment 175674

I used an old combo box with circuit board so all I had to do was drill two holes; one for the USB wart PS slot and one for the IR LED hole - I managed to do both effectively. The schematic is even simpler than the first version.
View attachment 175676

The code was streamlined and easily adapted to the Linkit.
C:
// ******************************************************************************
// LinkitBeaconVolControl v1.0 by DrG  **
// Project code to send a Volume Up signal to the TV remote when a Linkit 7697 **
// detects the presence of a beacon that is powered on by a sail switch that  **
// reacts to the blower motor of the (loud) HVAC unit.  **
//  **
// This software is offered strictly as is with no warranties whatsoever.  **
// Use it at your own risk.  **
// ******************************************************************************
//
// Uses Arduino IDE 1.8.7 and Linkit 7697
// IR LED operates from P3 with a 1k resistor to the base of a 2N4401 and
// a 82 ohm resistor driving a LED 55b IR LED (3.3V, ~40mA, .013 W)
// ******************************************************************************

// includes
#include <LBLE.h>
#include <LBLECentral.h>
#include <IRremote.h> // note: this library is in the Linkit board dir

// prototypes
bool ScanForTarget();
void VolUp(int steps);
void VolDown(int steps);

// defines
#define SCANTIME 2000 // scan duration (ms)
#define DATA_LEN 68  // hard coded array length
#define STEPS 9  // how many notches up or down (+/-1 in practice)
#define DelTime 100  // ms delay after each IR command
#define kHz 38  // carrier frequency
//#define DEBUG  // comment out for no serial port output

// globals
// the address String returned by LBLE.getAddress() for the beacon
String target = "20:91:48:4C:5B:5A(PUB)";
byte state = 0;  // track state =1 beacon on / 0 beacon off
int x;  // utility counter

//  Raw codes for Vizio remote were initially read using IRrepeater.ino
//  https://github.com/smallbeetw/arduinosketch/blob/master/IRrepeator/IRrepeator.ino
//  and the values were smoothed to 560/1690/4500/9000 to make this code data
unsigned int VolUpCmd[DATA_LEN] = {9000, 4500, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560};
unsigned int VolDownCmd[DATA_LEN] = {9000, 4500, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560};

IRsend mySender;
// ******************************************************************************
bool ScanForTarget() {
  // return true if target address is found in a scan
  byte returnval = 0;
  int ndevices = 0;

  LBLECentral.scan();
  delay(SCANTIME);
  ndevices = LBLECentral.getPeripheralCount();
  // go through the device list
  if (ndevices > 0) {
  for (x = 0; x < ndevices; ++x) {
  if (LBLECentral.getAddress(x) == target) {
#ifdef DEBUG
  Serial.println("  Target Found !");
  Serial.println(LBLECentral.getAddress(x));
#endif
  returnval = 1;
  break; // we don't need the rest of them
  }
  }
  }
  LBLECentral.stopScan();
  return (returnval);
}
// ******************************************************************************
void VolUp(int steps) {
  digitalWrite(LED_BUILTIN, HIGH);  // use board LED for feedback
  for (x = 0; x < steps; x++) {
  mySender.sendRaw(VolUpCmd, DATA_LEN, kHz); // array,length,frequency kHz
  delay(DelTime);
  }
  digitalWrite(LED_BUILTIN, LOW);
}
// ******************************************************************************
void VolDown(int steps) {
  digitalWrite(LED_BUILTIN, HIGH);  // use board LED for feedback
  for (x = 0; x < steps; x++) {
  mySender.sendRaw(VolDownCmd, DATA_LEN, kHz); // array,length,frequency kHz
  delay(DelTime);
  }
  digitalWrite(LED_BUILTIN, LOW);
}
// ******************************************************************************
void setup() {
  pinMode(LED_BUILTIN, OUTPUT); // init board LED (pb7 for linkit)
#ifdef DEBUG
  // Open serial communications
  Serial.begin(9600);
  Serial.println("LinkitBeaconVolControl v1.0");
  Serial.println("BLE begin");
#endif
  digitalWrite(LED_BUILTIN, HIGH); // use LED for error detection (remains on)
  // Initialize BLE subsystem
  LBLE.begin();
  while (!LBLE.ready()) {
  delay(10);
  }
  digitalWrite(LED_BUILTIN, LOW);
#ifdef DEBUG
  Serial.println("BLE ready");
#endif
}
// ******************************************************************************
void loop() {
  // Tracks the beacon appearance and turns Vol up and down
  if (ScanForTarget()) { //returns true if found
  if (state == 0) { // if new power up- vol up & change state / else ignore
  VolUp(STEPS);
  state = 1;
  }
  }
  else {  // no beacon found
  if (state == 1) { // if new power down- vol down & change state / else ignore
  VolDown(STEPS);
  state = 0;
  }
  }
}
// END **************************************************************************
Since I already had the raw codes for volume control, I did it that way, but the Linkit has an IrDA peripheral and I probably should learn how to use that if I do anymore IR stuff.

The only other thing I am considering is to dump the sail switch and battery and use one of these to generate the power for the beacon.
View attachment 175677
Great work!

As for that little windmill idea at the end, how big is that, relative to the blower that will push it? Is it going to significantly impact airflow?
 

crutschow

Joined Mar 14, 2008
34,449
You also need to rectify it which makes it a little more non linear.
Very little, since the current transformer is a current output, which is not significantly affected by the diode forward voltage drop.
But make sure you add a diode to ground for the reverse half of the sinewave, otherwise you may blow the diode, along with possibly damaging the transformer.
 

sparky 1

Joined Nov 3, 2018
757
The project goal is to hear audio periodically when background noise reaches an unacceptable level.
A microphone used as noise sensor can be positioned toward the blower sound location and another microphone at the audio location
retransmits and filters the audio by means of an amplifier. A current sense would add circuitry which is better devoted to goal that could later use noise cancellation to further goal of coping with a noisy humidifier plus other noise sources. Arduino microphone sensors are low cost and available.
 
Last edited:

Thread Starter

Raymond Genovese

Joined Mar 5, 2016
1,653
The project goal is to hear audio periodically when background noise reaches an unacceptable level.
A microphone used as noise sensor can be placed near the blower sound location and another microphone at the audio location
retransmits the audio by means of an amplifier. A current sense adds unnecessary circuitry.
Eventually, I gave up on the current sense transformer (and I just edited the title), but I think that it probably would have worked to power a beacon or other device.

But to your point...

The project goal is to hear audio periodically when background noise reaches an unacceptable level.
Specifically, it was to increase the volume of the TV while the blower motor is running...which frames what you are saying in general. I did think about other approaches. Mounting a microphone outside of the blower - somewhere around where the ears can be is going to require a whole heck of a lot of processing (and some power). Ambient noise levels change quite a bit just by what the TV puts out as well as any other activities that are ongoing. You don't want the circuit to react to the phone ringing or a truck or even laughter. It is not trivial.

I also thought about direction of arrival processing to identify the blower as distinct from other sources. That processing is not trivial either (although it is interesting). So, yes, what you are saying about mounting one very near the blower as a noise sensor makes sense. But to detect the over level and retransmit the audio with an amplifier is pretty complicated in contrast to...detect the over level and send the codes to the TV to up the volume...and when the over level has subsided, send the codes to the TV to turn the volume back down.

This actually works very well.

I have been in some newer cars where something similar goes on and when the ambient noise is high enough volume on the radio/stereo/whatever is increased. I'm not sure how they are doing it, but the inside of a car is comparatively, a much smaller space.
 
Top