Hello,
How could I generate a 30 mA 60 Hz current signal using a microcontroller that has a DAC? Is this possible?
How could I generate a 30 mA 60 Hz current signal using a microcontroller that has a DAC? Is this possible?
Yes. Since many MCU's are limited to 25 mA per pin, you might need to parallel pins or use a transistor.Hello,
How could I generate a 30 mA 60 Hz current signal using a microcontroller that has a DAC? Is this possible?
It doesn't have to be true analog. Do I need some extra hardware?Is it true analog or PWM? The Arduino, for example, has analog pins but they are simulated analog.
#define RefFrequ 500000 // 16Mhz / 32 steps for CTCSS sine wave generator
int SineDivider = 4065; // default sine wave divider
int ToneFrequ = 60;
int i ;
int sinetable[] // one cycle sine wave via R2R network.
{ 0,1,2,3,5,7,10,13,16,19,22,25,27,28,29,30,31,30,29,28,27,25,22,19,16,13,10,7,5,3,2,1, };
void setup ()
{
DDRB = B111111; // sets Arduino pins 7 to 12 as outputs.
PORTB = B100000; // R2R out at rest to half level.
SineDivider = (RefFrequ/(ToneFrequ));
}
void loop ()
{
Generate_Tone(); // start the tone
delay(1000);
TIMSK1 = 0; // tone off
delay(1000);
}
void Generate_Tone()
{
cli(); // interupsts off for setup
TCCR1A = 0; //
TCCR1B = 0; //B00000010; // no prescaler
// set compare match register for 1hz increments
OCR1A = SineDivider ;// = (16*10^6) / (1*1024) - 1 (must be <65536)
// turn on CTC mode
TCCR1B |= (1 << WGM12);
// Set CS10 no prescaler
TCCR1B |= (0 << CS12) | (0 << CS11) | (1 << CS10);
// enable timer compare interrupt
TIMSK1 |= (1 << OCIE1A);
sei(); // interupsts on
}
ISR(TIMER1_COMPA_vect){
PORTB=(sinetable[i++]); // write value from table to PORTB
if(i>=32){
i=0;
}
}
Are you sure? As far as I'm aware, an RCD has mains current through the Line wire passing through one secondary and current through the Neutral wire passing through the other secondary, to give net zero magnetic flux if both wires pass the same current.The CT has two identical secondaries, one for the real fault signal which goes to an amplifier, and the other to test the CT as shown.
Don't use the DAC. Use the MCU to control turning your 60Hz signal generator on off, with a double-OpAmp and tuning tank circuit to generate the 60Hz pure self-sustaining sine wave, and draw the 30mA from a power-supply, not from the GPIO pin.Hello,
How could I generate a 30 mA 60 Hz current signal using a microcontroller that has a DAC? Is this possible?
I don't have to use a DAC. It was just my first thought. I think a PWM from the micro to an op amp would the job, right?Don't use the DAC. Use the MCU to control turning your 60Hz signal generator on off, with a double-OpAmp and tuning tank circuit to generate the 60Hz pure self-sustaining sine wave, and draw the 30mA from a power-supply, not from the GPIO pin.
If you have to use the DAC is this homework? Harmonics?
I disagree, sorry. Please look closer. It's not so much a high-side switch as a voltage follower. The op-amp square wave oscillator drives NMOS M2 on to sink L1's current via D1 and D2, with M2 off R1 and M1 source current to L1. Because of C1 the source and sink currents will eventually balance out.This circuit is a bad design.
An NMOS high-side switch- doesn't work.
The device M1 should be a P-channel to work as a high-side switch.