Yep - I had two successes last night when I started my tinkering.
Firstly, after soldering pins onto the Pro Mini, I was able (eventually) to use the Uno to load a sketch to it (it came with bootloader and blink sketch already loaded). But this was not quite the 'piece of cake' I predicted. I have header pins on the Pro Mini, allowing easy connection to pins 11-13, Vcc, Gnd, and Rst. Because of the ISP indicator lights widget, pins 10-13 on my Uno are not accessible, so I thought I'd be clever and connect the Pro Mini to the ISP6 pins on my Uno. That's when the problems started. While 'Arduino as ISP' loaded on my Uno, I couldn't get it to load a modified blink sketch to the Pro Mini. The error was something like 'unknown board id'. I removed the 6 connections at both ends and did them again (and again just for good measure), but with the same result. I went back out to the garage, and re-flowed the solder joins on my Pro Mini header pins - and also the 16MHz crystal as one of the joints looked a little suspect. Still no joy. I was about to head out to the garage for a third time, to try and find a capacitor to put between Reset and Ground on my Uno, when I decided to take out the status lights widget and try making the connections from pins 10-13, Vcc, and Gnd on the Uno rather than the ISP6 block - and it worked! Go figure - I have no idea why - as far as I knew, they should be connected to the same pins on the 328P chip... Anyway - I'm not going to argue the point - I'm just happy that I now have a tried and proven mechanism to download sketches to the Pro Mini. Unfortunately, I will have to either modify my little ISP status lights widget to free up access to pins 10-13, or just solder the second row of header pins onto my Uno - I guess that's a simpler and probably more useful option.
The second success was with my DS3231 RTC. I downloaded a library for it, and it has several example sketches - a very simple 'Set' process, which I ran and managed to enter a time that was just 3 seconds away from my cell phone's time. Then I used a basic 'Get' example that wrote the details back to the serial console. I stuffed a CR2032 battery in the RTC, and then unplugged everything, and started it up again running the 'Get' script, and it was still just 3 seconds from my phone. Next, I found one of my old sketches that I used to test the DS1302, that uses my LCD 20x4 display, and did some quick hacks on that so I can run the script without needing to be connected to the computer for serial output. Again, I left it all unplugged overnight, and fired up the Uno, LCD and RTC simply with a 9v battery this morning - and it was still just 3 seconds from my phone. Yay!!
So the next project with the RTC is to create a nice 'Set Date and Time' sketch that uses the LCD rather than the serial input from the console, and that allows for minor adjustments, and 1 hour advance and retard operations for daylight savings. Then I want to experiment and understand the benefits of simply using the RTC lib on its own, as opposed to using the Time lib and 'syncing' to the RTC. I want to find the simplest way possible, that I can use the time from my RTC in my projects, and then to use it consistently, rather than every project using a different combination of libraries and commands to handle time. There seem to be endless different ways with different libraries and so on.
Postscript...
I spoke too soon. Came home this evening and switched on the Uno again, and boy - what a load of cobblers came up on the screen! I reset it and rebooted it, but still rubbish. However, I noticed that it kept initialising to exactly the same load of cobblers each time. So I took the battery out of the RTC and tried again, and it was still booting to the same point each time, until eventually, it started booting to 01/01/2000 at 00:00:00. So I'm hoping that all this means is that the battery I had was at the end of its life - it had been recovered from the motherboard of an old PC after all. I'll try again with a fresh battery tomorrow.
No comments:
Post a Comment