Pages: [1]   Go Down
Author Topic: Can anyone help with my switching signal problem?  (Read 604 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everyone!
I have been trying for a few days now to figure out how to generate two switching signals simultaneously using an arduino.. with no major breakthroughs as of yet..

The most annoying part is that i feel my problem is very simple in reality but i just cannot figure it out! Essentially all i want to do is generate 2 simple 30KHz square waves with a duty cycle of 45%. The second square wave should be delayed by 0.5*Period so that only one signal is HIGH and any time. like the first 2 waveforms in this photo.

http://www.powerguru.org/wordpress/wp-content/uploads/2012/08/Half-bridge-switching-waveforms.jpg

Does anyone know how to program this using an arduino, i can easily generate a simple 30khz signal (essentially the blink example that comes with the arduino software) but i dont know how to generate 2 simultaneously.
Any help would be greatly appreciated!

in case anyone is wondering i am building a half-bridge induction heater any am using the signals to control a pair of IGBT transistors.
like this schematic.

http://www.emeraldinsight.com/content_images/fig/3430090101005.png
Logged

Queens, New York
Online Online
Faraday Member
**
Karma: 106
Posts: 3772
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Direct port manipulation comes to mind, you should look into it.
Logged

Created Libraries:
TFT_Extension, OneWireKeypad, SerialServo, (UPD)WiiClassicController, VWID

Montreal
Offline Offline
Faraday Member
**
Karma: 30
Posts: 2602
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Leonardo has Dead Time generator on Timer4, I think specifically design to drive 3 phase motors. Haven't seen any library or IDE support, but you may try to search. Otherwise dig into data sheet. If jitter not an issue, you can try any others arduino board w/o hardware build-in support, than you run interrupt subroutine (TimerOne or MsTimer2) and switch outputs "manually"
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 637
Posts: 34602
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You don't actually want to switch the two parts of the H-bridge simultaneously because if you do then you will get shoot through where the transistors are on at the same time. This happens because the transistors do not follow the input signal exactly at the same time. Using just NPN transistors means that you can't switch any voltage higher than the level of the signal because that top transistor is acting as an emitter follower.
If you want to use this arrangement and avoid shoot through then turn the transistor off before you turn the other one on.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi HazardsMind,

Thank you for the suggestion, I never heard of direct port manipulation before now.
I feel it might be possible to use this method, the main problem i can see is the delay incurred when the program reaches the end of the loop.
Any suggestions on how to overcome this?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Grumpy_Mike,
Thanks for your reply.
Yes i am well aware of that, as you can see in my original post there is a link showing the switching signal waveforms.
In these waveforms only one pin is high at any one time, this is to maintain Zero Voltage Switching Conditions.
Logged

Queens, New York
Online Online
Faraday Member
**
Karma: 106
Posts: 3772
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Post your code so we can help you better.
Logged

Created Libraries:
TFT_Extension, OneWireKeypad, SerialServo, (UPD)WiiClassicController, VWID

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I dont have any way to measure frequency at the moment, but here is a basic idea of the direction i am going!!


float SWFreq = 30000;
float period = (1/SWFreq);
float ontime = (0.45*period*1000);
float bothoff = (0.05*period*1000);

 
void setup()
{
  DDRD = B01001000; // set PORTD (digital 7~0) to outputs
}

void loop()
{
  PORTD = B01000000; //pin 7 is high
  delay(ontime);
  PORTD = B00000000; //all pins are off
  delay(bothoff);
  PORTD = B00001000; //pin 1 is high 
  delay(ontime);
  PORTD = B00000000;//all pins are off
  delay(bothoff);
}


EDIT: Changed int to float.
 
« Last Edit: January 26, 2013, 07:27:37 pm by PidgeyDoyle » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I guess all i need to do is measure the delay caused by the loop ending and subtract it from the delay(bothoff); in the last line of code?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 637
Posts: 34602
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

That is not the way to generate a signal, you are using the whole of the processor. What you want to do is to set up a timer to trigger at regular intervals, the use the interrupt service routine to switch your pins.
If it is an induction heater why does it have to be so precise a frequency anyway?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi GrumpyMike,

I think you are right, my direct port manipulation code worked very well for low frequencies but didnt really work at khz levels.
The frequency generation doesn't have to be that accurate, just so long as zero voltage switching is maintained.
I have looked into interrupts like you said, once again my problem is that I cant figure out how to generate 2 signals to 2 pins without screwing everything up!!

 
Logged

Pages: [1]   Go Up
Jump to: