Short-range (10') AM-band transmit from 3.5mm Android headphone jack

Read Part 15 Devices of FCC regs: Low Power Radio - General Information | Federal Communications Commission

Yes I have read it and understood it, have you? You have to be able to prove you do not exceed the maximum ERP ( Effective Radiated Power ) and you must avoid certain frequencies. With this technique you can't.

What makes you think you can generate 530MHz from a processor that is only running at 16MHz?

Because this works (actually you helped someone in previous thread with similar):

NO! - those frequencies are in KHz not MHz.

this is transmitting screeches at 530 MHz,

As I said it is not MHz, what radio are you picking this up on? You will get a screech at 560KHz but you will not get any music or speech. This is because you are not producing amplitude modulation of the audio signal on the carrier wave but actually PWM which stands for Pulse Width Modulation.

So you need a radio that can pick up PWM or you need to generate AM ( Amplitude Modulation ). Amplitude modulation - Wikipedia
This requires external hardware, for a variety of circuits search for images using the words:-
collector modulation method for generating am wave

AM signals transmitting at 10' comply with FCC Part 15 Devices. Read the link I referenced; it should be easy for you to understand.

My typo on MHz meaning KHz.

I suspected I'd have to modulate this signal as you've pointed out (like a 1300 : 8 ohm transformer does using discrete components). If / when I get to that point will I be transmitting on analogWrite or digitalWrite?

If / when I get to that point will I be transmitting on analogWrite or digitalWrite?

The PWM output will need an RC filter to turn it into an analogue Audio signal. You will also need another PWM signal at the carrier frequency that has a fixed duty cycle.

AM signals transmitting at 10' comply with FCC Part 15 Devices. Read the link I referenced; it should be easy for you to understand.

Given that you are struggling to understand the concept of AM, and given that I have been a radio ham since 1973, I would suggest that it is you who do not understand that document and what it implies. You need to be able to demonstrate either with test equipment or detailed mathematics how you are complying. I find your comment insulting.

Grumpy_Mike:
The PWM output will need an RC filter to turn it into an analogue Audio signal. You will also need another PWM signal at the carrier frequency that has a fixed duty cycle.

Thanks I'll research RC filter as I've seen examples on this site & experiment with fixed duty cycle. I respect your experience & expertise in radio, Arduino & electronics.

Would someone please help me bridge the gap in analog audio in to PWM out RF transmission? I've interfaced a 104 (.1uF) capacitor with 100/100K voltage divider on 3.5mm input from Android phone. I'm getting about 2.5v on the Serial Port. I think I understand that an analog audio sine wave has to coalesce to square PWM wave. Notes throughout code are things I've tried over the past 2 days.

int audioPin = A0; // positive lead from 3.5mm phone headphone jack; other lead to GND
//int transmitPin = 10; // positive lead to antenna; neg. antenna lead to GND
const byte ANTENNA = 9;
//int val = 8;

void setup() {
  Serial.begin(9600);
  pinMode(ANTENNA, OUTPUT);
 
 // set up Timer 1
 TCCR1A = _BV (COM1A0);  // toggle OC1A on Compare Match, Timer Interrupts
 TCCR1B = _BV(WGM12) | _BV(CS10);   // CTC (clear timer) no prescaler
 OCR1A =  14;       // 530 kHz

}

void loop() {
  int sensorValue = analogRead(audioPin);
    float voltage = sensorValue * (5.0 / 1023.0);
  // print out the value you read:
  Serial.println(voltage);
  
  //val = analogRead(audioPin);
  digitalWrite(ANTENNA, voltage);
  //analogWrite(ANTENNA, voltage);
}

I think I understand that an analog audio sine wave has to coalesce to square PWM wave.

Yes.

Do not do any serial printing or floating point arithmetic in the loop because it slows down the sample rate to an extent that it will not be high enough to work. There is no need to convert the number into a voltage. You should see that 2.5 voltage change as you apply audio, if it does not change then it is either wired up wrong or you have not got a big enough input signal. Ideally you should get a swing between 20 and 1000 or so, if you see the full range of 0 to 1023 that means the audio is too loud and you are getting clipping which will distort the audio.

The analogue read returns a number between 0 and 1023, where as an analogue write accepts a number between 0 and 255. Give it a bigger number and it will just wrap round, that is it will just take the value of the least significant byte of the number you give it. So you must process what you receive by dividing it by four before you send it out, do this by shifting the value two places to the right with the shift operator >>

I do feel that this project is pushing the limits of your current knowledge and you are being hampered by your lack of fundamental knowledge of both what you need to do and how to do it.

p1ne
maybe this post can be useful
http://forum.arduino.cc/index.php?topic=88422.msg2181964#msg2181964

Grumpy_Mike:

OCR1A =  14;       // 530 MHz

What makes you think you can generate 530MHz from a processor that is only running at 16MHz?

530Mhz are too much but you can reach FM band at around 95-98MHz, maybe harmonics?
http://forum.arduino.cc/index.php?topic=85275.msg2608247#msg2608247
I tested it usind an SDR radio, it works. I fin also many other frequencies. Arduino make a lot of noise!

But the OP is asking for AM not FM.

Mike, I wasn't seeing voltage change before removing 100K voltage divider on audio input (I read about in similar thread), but after only applying .1 uF capacitor from audio input (3.5mm Android phone jack), I'm getting .25 volt difference when audio is applied (.45 no audio; .70 with audio), so that seems promising. If I remove .1 uF input capacitor, no voltage is returned in Serial Port. Although audio transmission is not working (yet), static is detected at 530 kHz, near jumper wire from pin 9. Now that I know voltage difference, do I continue on analogRead to digitalWrite & if so how to do calculation? analogWrite does not get detected by the radio at at all, on any pin.

int audioPin = A0; // positive lead from 3.5mm phone headphone jack; other lead to GND
const byte ANTENNA = 9;
int val = 0;

void setup() {
  Serial.begin(9600);
  pinMode(ANTENNA, OUTPUT);
 
 // set up Timer 1
 TCCR1A = _BV (COM1A0);  // toggle OC1A on Compare Match, Timer Interrupts
 TCCR1B = _BV(WGM12) | _BV(CS10);   // CTC (clear timer) no prescaler
 OCR1A =  14;       // 530 kHz

}

void loop() {
  int sensorValue = analogRead(audioPin);
    float voltage = sensorValue * (5.0 / 1023.0);
  Serial.println(voltage);
  
  //val = analogRead(audioPin);
  digitalWrite(ANTENNA, voltage);
  //analogWrite(ANTENNA, voltage);
}

.45 no audio; .70 with audio

That sounds wrong.
With audio the voltage should read above and below the voltage with no audio. If you don’t get that then nothing will work.

Your descriptions are hard to follow can you post a schematic please.

I wasn't seeing voltage change before removing 100K voltage divider on audio input

If you remove the voltage bias circuit then there is no chance it will work even if you see voltage changes as your input is floating and will pick up all sorts of rubbish.

Ok here's my schematic. Code and notes were posted in last reply.

Yes that circuit is basically correct although you don’t draw connections going into a capacitor like that. Just have one wire out of the capacitor and connecting to the other components. However the capacitor needs to be a lot bigger something like 47uF.

Now if you read the analogue input with no audio you will get a reading around 512 and with audio it will be above and below this. If you don’t get that then you have something wrong or the Audio from your phone is not loud enough.

Ok I'm using 47uF capacitor interfacing with 100K resistors as you suggested & A0 pin input and getting 485 reading with audio off, and 520 - 460 range with audio on. Still no music reception on AM 530 although pin 9 is definitely transmitting something as proximity to antenna is affected only at that radio frequency (static / hiss). Here's updated code. (I commented out Serial.println to test radio reception.)

int audioPin = A0; // positive lead from 3.5mm phone headphone jack; other lead to GND

const byte ANTENNA = 9;
int val = 0;

void setup() {
  Serial.begin(9600);
  pinMode(ANTENNA, OUTPUT);
 
 // set up Timer 1
 TCCR1A = _BV (COM1A0);  // toggle OC1A on Compare Match, Timer Interrupts
 TCCR1B = _BV(WGM12) | _BV(CS10);   // CTC (clear timer) no prescaler
 OCR1A =  14;       // 530 kHz

}

void loop() {
  int sensorValue = analogRead(audioPin);

  //Serial.println(sensorValue);
  
  digitalWrite(ANTENNA, sensorValue);
}

and 520 - 460 range with audio on.

That is only a small range and I would suggest it is not going to do much. That signal needs amplifying.

Still no music reception on AM 530

Not surprised because, as I have said before, you are not actually generating AM but pulse width modulation, and most radios are not equipped to demodulate that.

The first link I posted is of a sketch being able to generate an AM modulated signal. But I don't remember if I have tested it like I did on FM example.

Have you any idea about what that sketch actually did?
You might have got some tones but that could not be considered to be AM. It transmitted all over everywhere and the FCC would not have considered that to be legal. As the OP has found while it will transmit tones it can not transmit speach.

zoomx yes I got that digital tone sketch working before starting this project. That thread is really interesting!

Mike I got this working somewhat by changing antenna to digital pin 2 (from PWM pin 9), and removing 5V-connected 100K resistor (no detected signal when this was connected), while keeping the 100K-to-GND resistor (for some reason keeping this helped signal). Suddenly radio received my audio input, so success. I experimented with capacitor values & keeping 47uF seemed best.

The "reception" (a mix of screech and music from input) was effective within 12" (1 foot) radius in proximity to Uno board, and from an AM loop antenna wired up across the room, with no reception in-between the Uno & the antenna. This short-range noise was being received all over AM kHz spectrum (whereas the post zoomx linked previously is very tight on a single frequency). My experiment was not being transmitted / received at all on FM—I checked.

Any suggestions to clean up signal & focus it on desired frequency would be appreciated!

I previously linked to FCC rules on Unlicensed Operation of Low Power Radio for the benefit of those of us in the US; I'm posting Part 15 Devices here, so low-power hobbyists in the US are aware of the law:

Part 15 Devices
Unlicensed operation on the AM and FM radio broadcast bands is permitted for some extremely low powered devices covered under Part 15 of the FCC's rules. On FM frequencies, these devices are limited to an effective service range of approximately 200 feet (61 meters). See 47 CFR (Code of Federal Regulations) Section 15.239, and the July 24, 1991 Public Notice Opens a New Window. (still in effect). On the AM broadcast band, these devices are limited to an effective service range of approximately 200 feet (61 meters). See 47 CFR Sections 15.207, 15.209, 15.219, and 15.221. These devices must accept any interference caused by any other operation, which may further limit the effective service range.

This short-range noise was being received all over AM kHz spectrum

From the FCC Document

Section 15.209 contains general radiated emission (signal strength) limits that apply to all Part 15 transmitters using frequencies at 9 kHz and above. There are also a number of restricted bands in which low power, non-licensed transmitters are not allowed to operate because of potential interference to sensitive radio communications such as aircraft radionavigation, radio astronomy and search and rescue operations.

How are you going to verify that? Crossed fingers do not stand up in a court of law.

Further from the document:-

Home-built transmitters, like all Part 15 transmitters, are not allowed to cause interference to licensed radio communications and must accept any interference that they receive. If a home-built Part 15 transmitter does cause interference to licensed radio communications, the Commission will require its operator to cease operation until the interference problem is corrected. Furthermore, if the Commission determines that the operator of such a transmitter has not attempted to ensure compliance with the Part 15 technical standards by employing good engineering practices then that operator may be fined up to $10,000 for each violation and $75,000 for a repeat or continuing violation.


Any suggestions to clean up signal & focus it on desired frequency would be appreciated!

You have had it. To stop screeching reconnect the 100K and amplify the audio signal to get a bigger signal. To get it on frequency use an AM modulator and so you do not spread harmonics all over the place.

Those nuances of low-power transmission regulations are good to be aware of & follow. I'll experiment with LM386 amp module & voltage bias if/when confirmation of exact transmission frequency (which may not be possible given possibility of harmonics).