Looking for library NixieBeta4.h

More
3 years 9 months ago #9260 by Ty_Eeberfest
If the clock is actually counting 00 - 23 hours then this code here should be all you need to handle AM/PM.
if (tm.Hour > 11) {
    frame  = 1;
}
else {
    frame = 0;
}

// Or same thing stated more succinctly

frame = (tm.Hour > 11);

Since you mentioned that it works as expected sometimes (when you set the time manually) and fails other times, I'm wondering where in the overall scheme of things this hour checking code is located. Likewise for the code that makes "frame" actually turn on/off an AM/PM indicator. My reasoning is that if it only works under certain conditions then maybe one of those pieces of code is located in a place that it doesn't always get executed, e.g. inside an IF construct or in a function that only gets called when setting the time.

If the insulation on the wire on the toroid isn't turning black and stinking then it should be okay ;) If it's too hot to suit you then maybe you need to reconsider the value and the current rating of your inductor, or maybe play with the frequency and duty cycle limits of the MOSFET drive if they can be adjusted.

Look into it later when the dust is clearing off the crater.

Please Log in or Create an account to join the conversation.

More
3 years 9 months ago #9267 by RedeyePete
Something has gone amiss. This morning the clock was showing (roughly) 11pm at 8am.
There was no ripple on the 5V rail so I turned my attention to the 5V buck convertor.
I originally put in an LM7805 but it was running hot. So I replaced it with an off the shelf buck convertor.
There was no room left to mount it on the chassis. Imagine a U shaped aluminum chassis with boards mounted on either side and a birds nest of wires in the middle.
So I sealed it in heat shrink and to keep it away from the roasty toasty inductor, put it right next to the RTC. I have now put a shield around it so hopefully that will fix the problem.

I have removed
if (tm.Hour == 0)
frame = 0;

and added "{........}" to the original if statement. So now it looks like this:

if (tm.Hour > 11){ // Display AM or PM on OLED
frame = 1;
}
else {
frame = 0;
}

Testing ticking over at Midnight the display went to AM, and to PM at Midday.
So it looks ok now. But I won't celebrate just yet.

Please Log in or Create an account to join the conversation.

More
3 years 9 months ago #9268 by RedeyePete
Well it looks like it is loosing time when the power is off. I checked the RTC battery and it reads 3.1V plugged in. So I don't know what the problem can be. A faulty RTC module perhaps?

Please Log in or Create an account to join the conversation.

More
3 years 9 months ago #9269 by RedeyePete
OK I think I figured t out. After uploading the sketch with the new time, I need to rem out the clock set command and then do another upload. I have not been doing the second step.

Please Log in or Create an account to join the conversation.

Moderators: AccutronTy_EeberfestIan
Time to create page: 0.098 seconds
Go to top
JSN Boot template designed by JoomlaShine.com