Arduino Project 9 (2D/3D pictures and videos) â How to connect a Texas Instruments BQ32000 Real Time Clock (BQ32000DR, Uno, 1.0)
I went on free sample spree a little while ago and then got myself a few “younametheDIYunfriendlypackage”-to-DIP adapters off ebay (more details on the adapters are in one of my previous posts (DIP adapters to convert less DIY friendly packages (SOP, SOIC, TSSOP, MSOP, SSOP, SOT, LCC, LGA)). This is the first little chip from my free sample batch I’ve soldered onto one of the adapters to make it breadboard friendly.
I’m going to use one of those on a XBee-to-Ethernet concentrator in my wireless sensor network to add a time stamp to data frames which I’m buffering locally onto a SD-card on the concentrator during ethernet down time.
For all those who prefer a video instructable, please head over to YouTube to find both a 2D and 3D video instructable based on this post:
2. Tech spec:
Ambient Operating Temperature: â40Â°C to 85Â°C
Supply Voltage Range: 3V to 3.6V
3.Where to get one/many:
The BQ32000DR is free to sample from TI, their price chart lists them for Â£0.75 in 1k quantities.
Farnell will sell you a single one for Â£1.85 (Link to Farnell)
4. Let’s hook it up:
Since we can’t easily connect the SOIC-8 package to the Arduino I’ve soldered it onto a SOIC-to-DIP adapter.
Looking at page two of the data sheet we connect it to the Arduino Uno as follows:
BQ32000 Pin4 -> Arduino GND
BQ32000 Pin5 -> Arduino Analog Pin 4 (SDA)
BQ32000 Pin6 -> Arduino Analog Pin 5 (SCL)
BQ32000 Pin8 -> Arduino 3.3V
Looking at page 3 of the same data sheet (and because I’ve had a look in the Arduino forum where people didn’t get the DS1307 to work without I2C pullup resistors ) we also need to connect SDA and SCL with one 4.7KÎ© pullup resistors to the Arduino’s 3.3V supply.
As usual for a RTC the BQ32000DR also has a battery pin and a battery connected to this will get trickle charged from the main power supply. Both the main power supply and the battery connection should get capacitors on permanent circuits but for this little demo we’ll get away without the capacitors and battery.
I’m not going to spend much time explaining the IRQ pin, have a look at page 5 of the data sheet if you think it might be useful to you. Baseline, for a permanent circuit add another 4.7KÎ©Â pullup resistor between 3.3V and IRQ (just like we did with the SDA/SCL lines) to ensure this get’s turned off when the BQ32000 is running off it’s battery.
5. Let’s talk to it:
Since the BQ32000 is code and pin compatible with the popular Dallas/Maxim DS1307 RTC we can borrow the DS1307 Arduino library to talk to our BQ32000DR RTC
This version of the library works with the Arduino 1.0 IDE:
Simply unpack, copy the resulting DS1307 folder to your Arduino IDE library folder and open your Arduino IDE. You’ll now find the the examples I’m using under File/Examples/DS1307.
Let’s start with DS1307_demo_en. Upload, start the serial monitor and you should get more instructions on how this sketch works. Basically you paste a string into the serial monitor, hit send and thereby set the BQ32000DR to the current date/time.
The format is straight forward, just one typo to watch out. Make sure you replace the “A” in “A[00-49]” with a Y when setting the year. This is my example string:
Which gives me the following result in the serial monitor:
Now the second example, ds1307_rtc. This is very much the same as DS1307_demo_en just with the interactive part stripped out. The current time/date simply get set as variables in the void setup loop which runs once whenever the Arduino starts up before it moves on to loop through whatever you have sitting in void loop.
As one would expect from Texas Instruments, a very nice no-nonsense RTC