Picaxe 18M2 Update affecting amplifier

booski

Senior Member
Hi there.

I've built my own surround sound amplifier and im using an 18m2 to control a pair of SPI bus ds1802 uPots, an lm3914 bar graph display, IR control input and soon a temperature controlled fan.

I've noticed that when the amp is on with no music playing, I can hear a constant "beep beep beep beep" about every half a second from the speakers.

Now when I attach the picaxe to the computer and open the debug window, I found that everytime the debug window updates, the beeping sound co-insides with it as though to say its the picaxe serial updates injecting itself into the audio somehow.

Any ideas?
 

MartinM57

Moderator
Sounds plausible. Cross talk between the SerOut pin and the audio somewhere and somehow.

Always best to remove debug statements (especially the DEBUG command - it takes quite some time to execute) from production applications...:)
 

booski

Senior Member
"Information:
The debug command uploads the current variable values for *all* the variables
via the download cable to the computer screen. This enables the computer screen
to display all the variable values in the microcontroller for debugging purposes.
Note that the debug command uploads a large amount of data and so
significantly slows down any program loop."

That might explain something as I was wondering why the program took sooo long to run through each cycle i.e. volume takes some time to change.

The serout is only connected to the 3.5mm jack so there couldn't be an earth loop but the serin is connected to ground via the 22/10k resistor divider, perhaps, when the debug command is run, the picaxe sends data, but also checks for data possibly creating some sort of loop?

I don't know, just theory bashing :)
 

eclectic

Moderator
=booski;171275snipped to save space.That might explain something as I was wondering why the program took sooo long to run through each cycle i.e. volume takes some time to change.

The serout is only connected to the 3.5mm jack so there couldn't be an earth loop but the serin is connected to ground via the 22/10k resistor divider, perhaps, when the debug command is run, the picaxe sends data, but also checks for data possibly creating some sort of loop?

I don't know, just theory bashing :)
Have you yet removed the debugs, as Martin suggests?
If so, did the "clicking" stop?

e
 

Technical

Technical Support
Staff member
Debug simply 'outputs', so the data would only be present from the serial output pin along the pcb trace to the socket.

But that shouldn't matter if you just remove the debugs.
 

Dippy

Moderator
Absolutely.
Why not simply try the suggestions , have a go, and let us know?
You could do it in less than a minute surely:rolleyes: (and stop calling me Shirley:)).

If you are getting other funny noises then heed what Martin said about crosstalk. This could be track/wire proximities. And decouple chips with (say) 47nF ceramic caps. All PICs chuck noise out of their power pins. And you have good grounds and a nice smooth power supply?
 

booski

Senior Member
Absolutely.
Why not simply try the suggestions , have a go, and let us know?
You could do it in less than a minute surely:rolleyes: (and stop calling me Shirley:)).

If you are getting other funny noises then heed what Martin said about crosstalk. This could be track/wire proximities. And decouple chips with (say) 47nF ceramic caps. All PICs chuck noise out of their power pins. And you have good grounds and a nice smooth power supply?

yeah, i've not been home to try it but i think its possible, ill try it when I'm home next.

My debug command is at the start of the program and is only used once.
does the command set the picaxe to debug constantly in the background once the command been run once?
chips decoupled with 0.1 ceramics and power supply is custom built single supply regulated with pass transistors
 

hippy

Ex-Staff (retired)
DEBUG will only send data to the PC when it is executed within the program so it doesn't look like this should be the problem.

However, you say, "I found that everytime the debug window updates, the beeping sound co-insides with it". The debug display should not update except when DEBUG is executed so it seems the DEBUG is being executed other than at the beginning of the program, or the program is resetting itself, either a hard reset or a 'crash' reset.
 

Pauldesign

Senior Member
Hey Booski

I've noticed that when the amp is on with no music playing, I can hear a constant "beep beep beep beep" about every half a second from the speakers.
If what the gurus suggested didn't work, the following is also recommended if not for the issue at hand maybe for your future design hints:

- Your PSU/pcb might be poorly designed (thus high ripples and THD, can be corrupting the supply line).
- Your amplifier/pcb might be poorly designed (well, u did wanted surround sound in the first place, now u've got your wish and u complaining; oops not input surround sound :D)
- Might be dodgy ground connections.
- Might be 50/60 Hz from your mains reaching the speakers. Use filtering caps as Dippy suggested.
- Try to move amp input and tracks from noisy components or tracks.
- You may consider shielding amp or noisy components (switching devices) depending on which is easier to shield.
- Isolate your amp gnd connection and run your ground tracks in a star/hub topology (radiating pattern, where your center point is your PSU gnd).

How is your amplifier output and speaker connected? Is the connection bridge or single ended?

If bridge, then the output is differential, therefore recommended speaker cables/wires must be twisted pair (shielding is optional) to eliminate common mode noise.
If single ended, then wires (signal and Gnd) must be shielded and not twisted pair.

Just out of curiosity, what do u mean by?
regulated with pass transistors
 

Dippy

Moderator
It should only output when executed.
Isn't the answer to the question easily tested by running the debug screen and connecting the cable?

Can you determine anything in your code that functions at the beepbeep per second you hear?
Could it be the bargraph updating? Check it.
Just look to see what section of code (or function) is doing something at exactly the rate (and same time) of your beep-beep. That's something you can do.

Post your code.
post your schematic and picture of PCB.
You have a lot of things to investigate and ,as we can't see it, you should be experimenting to see what does and what does NOT affect what you hear.
So, do some tests and write down the results and then give us a summary.
 

booski

Senior Member
Hey Booski

If what the gurus suggested didn't work, the following is also recommended if not for the issue at hand maybe for your future design hints:

- Your PSU/pcb might be poorly designed (thus high ripples and THD, can be corrupting the supply line).
Its my first amp project connected to the mains, but im pretty dead certain that the power supply is ace
- Your amplifier/pcb might be poorly designed
This is possible, however I followed an STA540 circuit from spark fun pin by pin but the circuit is built on veroboard (I don't have any etching gear, yet)
- Might be dodgy ground connections.
- Might be 50/60 Hz from your mains reaching the speakers. Use filtering caps as Dippy suggested.
All chips have 0.1uf ceramic caps on supply pins
- Try to move amp input and tracks from noisy components or tracks.
Noisy components are built onto a seperate board with their own regulated 5v supply
- You may consider shielding amp or noisy components (switching devices) depending on which is easier to shield.
- Isolate your amp gnd connection and run your ground tracks in a star/hub topology (radiating pattern, where your center point is your PSU gnd).
I've done my best to implement a star system (but not entirely 100% certain of its methodology)

How is your amplifier output and speaker connected? Is the connection bridge or single ended?
using 2 STA540 chips in bridge mode and outputs to paired insulated speaker cable to a spring loaded fitting on the casing which are normally used by HiFi manufacturers

Just out of curiosity, what do u mean by?
regulated with pass transistors
My power supply needs to carry a lot of current at a low voltage due to the STA540 requiring a low voltage source than most amps. For maximum power I've used an lm7818 with a 2v zener on the base to bring the supply voltage upto ~20v. However, 2 chips, 4 channels, ~40watt/channel at 20v is around 160 watts of power or upto 8A of constant current.
The lm7818 can only carry max 1.5A so by using 2 BD911 transistors with the smoothed output from the rectifier on the collector, and the 7818 outputting onto the base of a pair of BD911 I get a much greater current carrying capability

Also, I'm back home today and had a quick look at the code this morning before leaving for work (Where I am now) and there is a debug at the very beginning of the code in the 'Main' Section so it is being run every time. I'll have a play tonight and remove the debug and see what happens.
I'm 80% sure that it is what's injecting the noise into the system.

Once again, I've got to say, an amazing forum with lots of very intelligent people helping out the not so intelligent like myself :p
Thanks very much!
 

booski

Senior Member
Yup!

Thats what it was, the debug slowing the circuit down and introducing the beep noise into the circuit somehow.

Thanks for all your help!
 
Top