DS1307 Driver/ Unable to set it up!
jmmb392
Posts: 22
Dear group,
I am extremely new in the propeller world, this is my first project, I am trying to count the IR pulses coming out of a power meter to measure the energy consumed and create an energy profile. To do that, I need to time stamp each pulse, that is, I need to be able to measure time. I am trying to setup the ds1307 RTC clock but I do not know how to do it. I am using a Propeller Mini, and I am using:
P0 = RTC SDA
P1= RTC SCL
I downloaded this:
http://obex.parallax.com/object/207
but I can not get it to work, after I enter the time it returns Operation failed!
I also downloaded the files that I am attaching, but after I enter the time, it returns
00/00/00
00:00:00 AM
I really appreciate your help.
Thank you
I am extremely new in the propeller world, this is my first project, I am trying to count the IR pulses coming out of a power meter to measure the energy consumed and create an energy profile. To do that, I need to time stamp each pulse, that is, I need to be able to measure time. I am trying to setup the ds1307 RTC clock but I do not know how to do it. I am using a Propeller Mini, and I am using:
P0 = RTC SDA
P1= RTC SCL
I downloaded this:
http://obex.parallax.com/object/207
but I can not get it to work, after I enter the time it returns Operation failed!
I also downloaded the files that I am attaching, but after I enter the time, it returns
00/00/00
00:00:00 AM
I really appreciate your help.
Thank you
Comments
Also, pin 28 has the required pullup resistor on it. Pin 29 also "should" have a pullup, but not all boards have this (including the Mini) and they work fine otherwise as long as the I/O driver is written for this case (The boot loader and most I2C drivers in the ObEx account for this). If you're going to put the RTC on pins 0 and 1, use a 4.7K pull up resistor (to +3.3V) on both lines.
Hello Mike,
Thank you for your response, I understand that I have to use pin 0 and pin 1 as SDA (_clockDataPin) and SCL (_clockClockPin) respectively, I already did that and it does not work. For the pull up resistor issue, I am using the following board kit:
https://cdn-learn.adafruit.com/downloads/pdf/ds1307-real-time-clock-breakout-board-kit.pdf
They use 2.2k resistors, is that correct, or should I replace them with the 4.7k resistors that you suggest?
Thank you for your help!
P0 is physical pin 41 on the Mini, P1 is physical pin 42.
Your posted code specifies pins 28 and 29. You really have to post the actual code you're using. Otherwise we're all guessing what's wrong ... not very helpful.
Thank you for your response Mike, I apologize I am now attaching the files that I am actually using.
Hi again Mike,
I purchased 2 ds1307 kits, I put together the second one, and replaced the first one, still no answer!
Edit: DS1307 does not drive SDA high, so no inline resistor. In fact, depending on configuration, it may keep it from driving a good low. EndEdit
Hi Mike,
I was never able to make it work. What I did, I replaced the propeller mini, and instead, I used a Propeller demo board, I used P4 for SDA and P5 for SCL, and it worked at the first try. Maybe the propeller mini was defective. Thank you for all your collaboration and patience. Now, I want to be able to count the IR pulses coming out of a power meter to measure the energy consumed and create a daily/monthly energy profile. To do that, I need to time stamp each pulse, that is, I need to be able to detect the pulse and then get the time when the pulse was detected and store it in a variable. I finally got the RTC to work, now, how do I create a variable to store the time and date every time a pulse is detected? I am attaching the code where I got the clock to work.
Another way to get the information you want would be to count the number of pulses over a fixed interval of time, say 5 minutes, and store that total. Using 5 minute intervals, you will have 288 intervals per day, each with the number of pulses equal to the energy consumed in during that interval, in watt-hours.
P30/P31 are the programming pins which would be available at the Prop Plug connection.
https://www.parallax.com/sites/default/files/downloads/32150-Propeller-Mini-RevA-Schematic-v1.3.pdf
P30 goes to P30, but P31 goes to P29
[img][/img]
Is it possible that the Prop Plug could be turned upside down? When I first assembled the Propeller Kit I thought it odd that the logo side of the Prop Plug was facing down. I use a lot of Schmartboard modules currently and the logo side faces up.
On the Propeller Mini the GND and RX pins are clearly marked on the top side of the board. The resulting arrangement would have the label side up.
Thank you all for your responses. I decided to switch to a propeller demo board and everything worked. I have already programmed the propeller to use two cogs to read 2 optical ports coming from the power meters and store the values in variables. Now, I want to be able to save those values in a EEPROM for backup and also send those values wirelessly via Xbee, I have no clue on how to start doing any of the two tasks. I am attaching my latest code for your revisions and suggestions.