Fairy lights controlled from spacešŸ˜ Recommending RTC(MCP7940N) and GPS(NEO-M8N) and providing their libraries

Engle

Active member
The main interest of this project should probably be the real time clock IC and GPS board.

For the RTC, the MCP7940N is a PDIP-8 package with I2C connectivity and a key feature is that it has alarms and the capability to signal an alarm with a digital output, even in battery backup mode. This allowed me to place a PICAXE 20X2 in sleep and doze power saving modes, dependent on whether I wanted HPWM active at the time. The PICAXE would then wake using a hardware interrupt from the clockā€™s configured alarm.

The MCP7940N is not commonly available from eBay/AliExpress but I found it much cheaper than the DS1307+ when buying from an electronics retailer and itā€™s also rated to work in cold temperatures. The marketplace sellers seem to focus on the DS1307, that is only specified to operate down to 0Ā°C, instead of the DS1307N, or DS1307N+. Having an alarm on the MCP7940N also meant the program didnā€™t need to check the time every second. Perhaps a drawback of the MCP7940N is that it wants a crystal with 6 to 9pf load capacitance, instead of the more common 12pf. Again, these are just as cheap and readily available from an electronics retailer.

The other point that may be of interest is the configuration of the NEO-M8N board. Mainstream use of GPS seems to filter and decode the streaming of the various ASCII based NMEA message types that are enabled by default. I turned these messages off. The UART was silent and the PICAXE didnā€™t have to filter junk anymore. Instead, I used U-BLOXā€™s own binary UBX protocol was used, which meant specific information could be requested and the responses then checked. I found the binary format easier to handle, such as day 30 is just the byte value 30 instead of two ASCII characters ā€œ3ā€ & ā€œ0ā€. Setting an alarm seemed easy too, just read the time which populates time and date variables, adjust what you want and then use the moduleā€™s Alarm_Set and Alarm_Enable in your program.

Thereā€™s a lot of inline notes in the program and supporting RTC and GPS modules/libraries, so I hope this may be of use to someone. A full message check is performed on the UBX message responses, including the frame sync, message type, length and the two-byte Fletcher-16 checksum.

I previously issued Debugger and Timing modules and these were updated too, with the debugger now supporting hex output and a splash screen at boot-up. These are in the zip, along with the schematic, PCB and photos. The master copies are held on GitHub here .

As for the rest of the project itā€™s a progression of the simple Solar to USB Project . It had 1 set of solar lights and 3 sets of battery lights, that were transferred to the AC output of a L9110 H-Bridge operating on the 5V rail. The project will save all those AA batteries and the lights are much brighter too. Additionally, a festive lamppost was powered using a DC Booster, providing 23V, and this had a current limiter that was implemented with discrete components.

The DC Booster for the lamp and the GPS were power hungry when not in use, so thereā€™s MOSFETs switching their supplies off when not in use. In fact, the GPS was only briefly powered up once a day when an RTC alarm told the PICAXE to update the clock with time information from the GPS. The whole project was powered by an old 19V PC power supply in an outdoor waterproof box.

Harking back to the origins of winter festivities I wanted the Sun to go down and lights to come on at the same time. At first, I was a little disappointed when the circuit turned on almost 2 seconds late! Then I checked my expensive phone (mobile operator) and found they were wrong, and the fairy lights were right!! šŸ˜

I would have liked the lights on for just the 12 Yule days from the Winter Solstice to New Years Day. Itā€™s easy to configure the enabled days but lifeā€™s full of compromises and itā€™s currently set from 1st Dec to 4th Jan to keep the Mrs happy. šŸ„³+šŸ˜ = šŸ‘« Lol.
FairyLights_RTCandGPS_5Schematic.png
FairyLights_RTCandGPS_4Lights_on-min.jpg
 

Attachments

Back
Top