See post #38, but it only operates within a limited range of frequencies. If the voltage on the capacitor reaches the supply it will no longer have a 50% duty cycle.why not use frequency doubler followed by frequency divider? this will ALWAYS give you exactly 50% duty cycle.
Depends on which signal phase causes saturation in whatever is downstream. 30% high means 70% low. Something that is integrating during the low phase might not have enough time to recover during the high phase.What I can’t understand is why something would not saturate at 50% duty-cycle but would at 30%. Sounds back-to-front to me.
Yeah, that is the problem. Adjusting a time period, and adjusting the *ratio* of two time periods, are two very different problems to solve.I might have not understood the problem completely, I thought to add a little more ON-time to increase the duty cycle, but that ON-time would be different for each frequency to achieve 50% duty cycle. My bad.
thanks, have not seen that post...See post #38, but it only operates within a limited range of frequencies. If the voltage on the capacitor reaches the supply it will no longer have a 50% duty cycle.
OK, here is a scheme to adjust the duty cycle in 1% increments, which will work unless that input frequency is changing quite rapidly:I'm a little disheartened.
Honestly I imagined it wouldn't be easy. At this point the only real solution would be with an ATtiny. I have to find someone to help me for the moment with code and then, as Jerry rightly advised, it's time for me to learn to do it too, but I imagine it won't be something immediate.
Anyway I have to compliment this forum and obviously its participants, I didn't imagine I would find so much participation and solidarity, thank you so much!



Good afternoon dear Jerry,Just for fun I tried it with two Arduino UN0s. One to generate the signal with two pots to vary frequency and mark/space, the other to convert to 50/50 mark space. Code is:
int mark = 0;
int counter = 0;
int latest = 0;
int last = 0;
void setup() {
pinMode(7,INPUT);
pinMode(4,OUTPUT);
}
void loop() {
if(last == 0 and latest == 1){
mark = counter*2/3;
counter = 0;
digitalWrite(4,HIGH);
}
counter++;
last = latest;
latest = digitalRead(7);
if (counter>mark) digitalWrite(4,LOW);
}
Yellow is input, blue is output
View attachment 344123
View attachment 344124
View attachment 344125
Whilst I think the 555 solution is really elegant, once you get used to processors it becomes quick and easy. This took me about two hours to lash together and write the code (which could do with some improvement but it works). As mentioned, before, the Digispark ATTiny85 would be a quick inexpensive solution
Yes, with small adjustments. I strongly recommend you use the Digispark ATtiny85 because it actually plugs directly into the USB socket on your PC and it has a voltage regulator on board. I’ll try it myself some time next week just to make sureWould the program you posted be enough to program an ATtiny to do the job I want? I didn't dare ask for that much, but for me it would be great!
Yes, with small adjustments. I strongly recommend you use the Digispark ATtiny85 because it actually plugs directly into the USB socket on your PC and it has a voltage regulator on board. I’ll try it myself some time next week just to make sure
Fantastic, I can't believe it!!! I hurry to order an ATtiny85 on Digispark pcb to try it as soon as possible, I can't wait. Then I think of programming an ATtiny via an Arduino uno as an ISP programmer since I will mount the micro itself into my little circuit.This script works on the ATtiny85 Digispark. Input into P2, Output from P3. Let us know how you get on. By the way, in theory ma the value of "mark" should be period/2 but for some reason it's not exact so adjusting it to mark = period * 3/5 gives a better result on my 'scope. You could adjust this to suit - the mark space appears to remain the same across the input frequency and mark/space range.
One thing to be aware of with the Digispark,, there is a 5 second delay before it starts to implement the code. When uploading a new program, you "upload" and quickly insert the Digispark into the USB port within those five seconds. If you are comfortable to use a bare 8 pin IC this won't happrn, but you'll need to buy or build a programmer.
int mark = 0;
int counter = 0;
int latest = 0;
int last = 0;
void setup() {
pinMode(2,INPUT);
pinMode(3,OUTPUT);
}
void loop() {
if(last == 0 and latest == 1){
mark = counter*3/5; // theoretically mark = counter/2
counter = 0;
digitalWrite(3,HIGH);
}
counter++;
last = latest;
latest = digitalRead(2);
if (counter>mark) digitalWrite(3,LOW);
}
You'll be back, when you find out that saturation doesn't depend on just the duty cycle. . .Fantastic, I can't believe it!!! I hurry to order an ATtiny85 on Digispark pcb to try it as soon as possible, I can't wait. Then I think of programming an ATtiny via an Arduino uno as an ISP programmer since I will mount the micro itself into my little circuit.
I will definitely keep you updated on the result, in the meantime I send you my infinite thanks!!!