¿ªÔÆÌåÓý

W8TEE B40 real time clock connections #w8tee


 

Jack,
I have the 1.08 version of your code and everything is working great, except the connections for the real time clock module have me stumped. I see the reference to pin 53 in the code, but it seems like the RTC module requires 3 pin connections in addition to Vcc and Gnd. I have the same Keyestudio DS3234 module you have pictured in v.04 of the manual. Am I missing something simple?

73 Loren KA5U


 

Jacks on vacation...might be a while before he responds.


 

Hi Loren - I am currently building the B40 but I am a few days behind you (looking at the pace of my building and my projection of free time). If you don't mind, I have a quick question for you.?

I noticed that there is a place for a capacitor (C14) on the board but there is no mention of C14 in the bill of materials, or on the schematic or in any of the other documentation. There is an electrolytic capacitor shown in one? photos and it looks like it simply connects from the the DC source to ground to dampen any voltage fluctuations. Is that right? What value, if any, for C14 did you use??

I'll wait patiently until Jack returns from vacation to hear about the rotary encoder or I may try to figure it out in the meantime.?

Thanks and 73,
-Rob
N4MN


On Sun, Oct 22, 2017 at 11:49 am, <lsgroff@...> wrote:

I have the 1.08 version of your code and everything is working great, except the connections for the real time clock module have me stumped. I see the reference to pin 53 in the code, but it seems like the RTC module requires 3 pin connections in addition to Vcc and Gnd. I have the same Keyestudio DS3234 module you have pictured in v.04 of the manual. Am I missing something simple?


 

Hi Rob,
C14 is a 100uF electrolytic cap.?

Good luck and 73,

Loren


 

Hi Loren - thanks for the information on the cap. I don't have one in and it seems to work fine. I'll keep an eye on it though.

I have been looking at how to hook up the RTC and connect it to the SPI bus. It looks like the?AD9850 uses the SPI bus. From the code CLK should connect to D52, MOSI should connect to D51 and then the code defines the Chip Select (SS) as being on D53 (RTCCHIPSELECT). However when I hook up those connections and enable the RTC, I see the clock - but the time is not correct. It's all zeros in 2000. So clearly I'm doing something wrong.

Maybe someone else in the forum here knows how to hook up the DS3234.

73,
-Rob
N4MN


 

Okay, I figured it out. I was close. The AD9850 only uses the MOSI because it is writing the frequency on the bus. The RTC uses the MISO because it is reading the clock information from the bus. On the Mega 2560 the MISO is the D50 pin. So to recap, connect the pins like this:

GND -> GND
VCC -> +5v
SQW -> not used
CLK -> D52
MISO -> D50
MOSI -> D51
SS ->? D53

Pins D50 - D53 are on the bottom of the board near TP4 (see below).?



 

Thanks Rob,
That's exactly what I was missing.

BTW, it looks like the colors on your display are inverted. Others have encountered the same problem, depending on the display.

For example, see Jack's response in this thread /g/BITX20/message/32909.?


 

There was also another thread (sorry, don't recall number) detailing the real fix: the "complement" operator (~) before each color 'int' value. It would seem some sketches had that operator removed.

73 de ZL2DEX


 

I thought the screen was pretty ugly, but i thought that those colors were probably just some "default" theme or something. Thanks for the tip.?

-Rob


George Baumann
 


 

That's the one! In particular, near the bottom, #32665 and thereabouts. :) Thanks ...


 

Alrighty! I have corrected those horrible colors. Just uncommenting the block with the "alternate colors" and commenting out the other block fixed the issue as you can see below. I did notice that the RTC has some garbage being displayed on the screen. I'm going to add the capacitor to the power connection and see what happens. I may also add the caps to the rotary encoder to debounce the detents.

Has anyone else seen this? Or am I just the lucky one??


 

I'm waiting for my RTC so I have no results yet obviously.? Dose the data change randomly as you view it?? looks like something needs termination...my uneducated guess for now
73

On Thu, Nov 2, 2017 at 5:27 PM, <robert.m.cox@...> wrote:
Alrighty! I have corrected those horrible colors. Just uncommenting the block with the "alternate colors" and commenting out the other block fixed the issue as you can see below. I did notice that the RTC has some garbage being displayed on the screen. I'm going to add the capacitor to the power connection and see what happens. I may also add the caps to the rotary encoder to debounce the detents.

Has anyone else seen this? Or am I just the lucky one??



 

I put in a little debugging in the?ShowTimes() function and it looks like the time starts out okay (the first entry in the serial monitor) but then immediately the seconds drop off (see below). I think the garbage is coming from these uninitialized pieces of memory in the DateTime variable, it is probably coming from the?secondsBuff variable on or about line 1295.

incre = : 100
? Current frequency: 7247800
ID = 9481
Current time: 11/02/2017? ? 18:43:00? ? UTC 13:43:00
Current time: 11/02/2017? ? 18:43:? ? UTC 13:43:
Current time: 11/02/2017? ? 18:43:? ? UTC 13:43:
.
.
.
Current time: 11/02/2017? ? 18:43:? ? UTC 13:43:
Current time: 11/02/2017? ? 18:43:? ? UTC 13:43:
Current time: 11/02/2017? ? 18:43:? ? UTC 13:43:
Current time: 11/02/2017? ? 18:43:`? ? UTC 13:43:`
Current time: 11/02/2017? ? 18:43:`? ? UTC 13:43:`
Current time: 11/02/2017? ? 18:43:`? ? UTC 13:43:`
.
.
.
Current time: 11/02/2017? ? 18:43:? ? UTC 13:43:
Current time: 11/02/2017? ? 18:43:? ? UTC 13:43:
Current time: 11/02/2017? ? 18:43:? ? UTC 13:43:
Current time: 11/02/2017? ? 18:43:5? ? UTC 13:43:5
Current time: 11/02/2017? ? 18:43:? ? UTC 13:43:
Current time: 11/02/2017? ? 18:43:? ? UTC 13:43:
Current time: 11/02/2017? ? 18:43:? ? UTC 13:43:
.
.
.
Current time: 11/02/2017? ? 18:44:0? ? UTC 13:44:0
Current time: 11/02/2017? ? 18:44:0??!i??? ? UTC 13:44:0??!i??
Current time: 11/02/2017? ? 18:44:0??!i??? ? UTC 13:44:0??!i??
Current time: 11/02/2017? ? 18:44:0??!i??? ? UTC 13:44:0??!i??
Current time: 11/02/2017? ? 18:44:0??!i??? ? UTC 13:44:0??!i??
Current time: 11/02/2017? ? 18:44:05? ? UTC 13:44:05
?
On Thu, Nov 2, 2017 at 03:35 pm, Larry Smith wrote:

I'm waiting for my RTC so I have no results yet obviously.? Dose the data change randomly as you view it?? looks like something needs termination...my uneducated guess for now
?


 

Okay, that was probably the easiest bug I've ever fixed... ever.

There are two lines of code that need to be uncommented. These were probably commented out by mistake.

The first is in the ReadTimeDate() function around line 1220.
void ReadTimeDate() {
? char buff[6];
? char secondsBuff[3];
? int TimeDate[7]; //second,minute,hour,null,day,month,year
? int seconds; // uncomment this line.

The second is in the same function just further down around line 1279:?
? if (TimeDate[0] < 10)
? ? strcat(DateTime, "0");
? seconds = itoa((int) TimeDate[0], secondsBuff, DEC);? ?// uncomment this line
? strcat(DateTime, secondsBuff);? ? ? ? ? ? ? ? ? ? ? ? ? // seconds
?
So far my RTC has been running flawlessly for about 10 minutes or so. However I do notice that my rotary encoder is not as responsive as it used to be. Perhaps the Arduino is handling the interrupts for the clock and missing (or queuing) the interrupts for the rotary encoder? I don't know how all that "interrupt handler" stuff works on the Arduino. I do know that if I take out the RTC then the rotary encoder works properly.

73,
-Rob
N4MN


 

After some code investigation, I discovered that the RTC does not use an interrupt, the clock is polled and updated every time though the Arduino loop which turns out to be between 4 - 6 per second with debugging turned on (it's probably more often with debugging turned off).

I added some code that only updates the RTC only once per second (or very close to once per second) and that seemed to help out the responsiveness of the rotary encoder although if I kept turning the knob, the frequency display would miss a few increments because the Arduino was updating the clock. Perhaps Jack will have some suggestions when he returns from vacation.

73,
-Rob
N4MN


 

Hi,

?

I am just getting back into the B40 stuff. I like the clock idea, but.

?

Why use the SPI bus RTC clocks, when there are tons of I2C RTC clocks out there ( I¡¯ve got at least 5 or 6 RTC I2C¡¯s laying around)? I¡¯ve used the I2C bus RTC clocks for years in arduinos and they work great even in interrupt based code for arduinos. Was there some sort of design need for it? I am just curious. ??Might play around and change Jack¡¯s code to see if it works, but I do not want to start another code path.

?

73,

Kevin KB0VHA


 

¿ªÔÆÌåÓý

I came up with the idea of adding a RTC but onlyJack can respond as to why he chose SPI. Maybe have an option?

Bill, VK7MX


On 8/11/2017 1:58 PM, Kevin Hutchinson wrote:

Hi,

?

I am just getting back into the B40 stuff. I like the clock idea, but.

?

Why use the SPI bus RTC clocks, when there are tons of I2C RTC clocks out there ( I¡¯ve got at least 5 or 6 RTC I2C¡¯s laying around)? I¡¯ve used the I2C bus RTC clocks for years in arduinos and they work great even in interrupt based code for arduinos. Was there some sort of design need for it? I am just curious. ??Might play around and change Jack¡¯s code to see if it works, but I do not want to start another code path.

?

73,

Kevin KB0VHA


Vince Vielhaber
 

Maybe he already happened to have one!

Vince.

On 11/07/2017 10:52 PM, William R Maxwell wrote:
I came up with the idea of adding a RTC but onlyJack can respond as to
why he chose SPI. Maybe have an option?

Bill, VK7MX


On 8/11/2017 1:58 PM, Kevin Hutchinson wrote:

Hi,



I am just getting back into the B40 stuff. I like the clock idea, but.



Why use the SPI bus RTC clocks, when there are tons of I2C RTC clocks
out there ( I¡¯ve got at least 5 or 6 RTC I2C¡¯s laying around)? I¡¯ve
used the I2C bus RTC clocks for years in arduinos and they work great
even in interrupt based code for arduinos. Was there some sort of
design need for it? I am just curious. Might play around and change
Jack¡¯s code to see if it works, but I do not want to start another
code path.



73,

Kevin KB0VHA
--
Michigan VHF Corp.


 

Yup I do that too, use what I've got on hand. If I have time this week maybe I'll add the standard RTC code in and ifdef it so you can chose which RTC module you want to have. When Jack gets back from "vaca" I will ship him a copy of the changes and he can use if he wants. Most of the RTC modules have an extra eeprom on board you can use and you can never have enough memory. I use it to store web pages on one of my projects.

Another fun thing to add to the B40 would be a wifi module, just think of the possibilities..

Before for I forget (trying to get caught up on things), did Jack ever come out with the ACG card and info on hooking up the B40 S-meter?

73,
Kevin - KB0VHA