Show Posts
Pages: [1] 2 3 ... 50
1  Using Arduino / Networking, Protocols, and Devices / Re: Stuck with RTC on I2C. on: August 26, 2014, 04:50:06 pm
Ok folks,
I'm really stuck.

This is a sketch I am trying to bash together to set/read the 1307 RTC chip.

Other sketches "bit bash" with the wire.h and I don't know if that is part of another problem.

As I have a working sketch with a 1307 RTC (and all works) I am trying to get this sketch working.

Alas
Serial_clock:40: error: 'DS1307' does not name a type

Means nothing to me.

Sketch attached below.
I'll try to work out what that error means, but in the mean time....
2  Using Arduino / Networking, Protocols, and Devices / Re: Stuck with RTC on I2C. on: August 26, 2014, 03:03:42 am
Well,

The 8583 problem was resolved by me finding a working sketch and a bit of hacking.
The library was outdated and someone helped me with the how to make the older library working.

The other RTC is still not working as it is one of those "TINY RTC" boards.
3  Using Arduino / Networking, Protocols, and Devices / Re: Stuck with RTC on I2C. on: August 25, 2014, 10:29:26 pm
Folks,

All working.

Found the problem/s.

I'm a step further forward now.
4  Using Arduino / Networking, Protocols, and Devices / Re: Stuck with RTC on I2C. on: August 25, 2014, 09:33:31 pm
This is the .h file:

These are the initial problems:
    int bcd_to_byte(byte bcd);
    byte int_to_bcd(int in);

Near the bottom.

But there are heaps more I believe.


Code:
/*
  Implements a simple interface to the time function of the PCF8583 RTC chip

  Works around the device's limited year storage by keeping the year in the
  first two bytes of user accessible storage

  Assumes device is attached in the standard location - Analog pins 4 and 5
  Device address is the 8 bit address (as in the device datasheet - normally A0)

  Copyright (c) 2009, Erik DeBill


  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/


/*

   Usage:
      PCF8583 pcf(0xA0);
      pcf.get_time();

      Serial.print("year: ");
      Serial.println(pcf.year);


      pcf.hour = 14;
      pcf.minute = 30
      pcf.second = 0
      pcf.year = 2009
      pcf.month = 9
      pcf.day = 12
      pcf.set_time();


*/

#ifndef PCF8583_H
#define PCF8583_H

#include <WProgram.h>
#include <../Wire/Wire.h>

class PCF8583 {
    int address;
  public:
 
    int milisec_A;
    int second_A;
    int minute_A;
    int hour_A;
    int day_A;
    int second;
    int minute;
    int hour;
    int day;
    int month;
    int year;
    int year_base;
    int timmer;

    PCF8583(int device_address);
    void init ();
   
    void get_time();
    void set_time();
    void get_alarm();
    void set_daily_alarm();
    int bcd_to_byte(byte bcd);
    byte int_to_bcd(int in);


};


#endif  //PCF8583_H



5  Using Arduino / Networking, Protocols, and Devices / Re: Stuck with RTC on I2C. on: August 25, 2014, 09:30:49 pm
Quote
I have two different types of RTC units.
What kind are they?

Pete

Pete,

One is a "Tiny RTC" and one is a 8583 board:
http://www.futurlec.com.au/Mini_PCF8583.jsp

I just realised that they won't work with the same sketches and when I tried to load the 8583's sketch it has a problem with "BYTE" in the .h file.
6  Using Arduino / Networking, Protocols, and Devices / Re: Stuck with RTC on I2C. on: August 25, 2014, 09:27:50 pm
Well,

This may be where I am falling down:

In the sketches I have used and which work, they:
#include "DS1307_1.h"

so the "DS1307_1.h" file is in that directory.

Though I have noticed that there is also a DS1307 directory in the librarys folder too.

I don't know why.

But I am working on  a new sketch and it too has its own DS1307 files.

In said files there is a line:
#define DS1307_CTRL_ID B1101000  //DS1307

in the .h file.

Ok......  Just shot myself in the foot.

Thing is I have a couple of these "Tiny RTC" units - yeah:  read about them.......

And I also have a 8583 RTC unit.

Alas its code is error ridden with "byte" in the .h file which are not liked.

So I can't test it.  (Just realised that now.  Wondering why the 1307 wasn't working with the 8583 chip.)

So I am annoyed/confused to what is going on.

I can run the 1307 test sketch and "set the time" but when I reset it, the time restores to the initial weird date.
It is valid, but just WAY in the future.

The battery is ok.  Checked it with a DMM.  3.8 volts.

I have a few days off work and though I would put them to good use on the Arduino projects I have going.

Seems I am getting nowhere fast!
 
7  Using Arduino / Networking, Protocols, and Devices / Stuck with RTC on I2C. on: August 25, 2014, 07:46:38 pm
Yeah, I probably deserve this.

I have two different types of RTC units.

Running I2C scanner one shows up on address 68 (or 50) and the other is on 51..

I remember going through this as I have just tried to help someone else with a problem I had.

Don' t you have to set the RTC address - with a bit shift - somewhere in the code?

I can't seem to get to save the time to the RTC units.   Either of them.

One is using a 1307 and the other is a 8583.

Please, anyone?
8  Using Arduino / Networking, Protocols, and Devices / Re: "Tiny RTC I2C Module" issue on: August 25, 2014, 06:40:41 am
Hello everyone with Tiny RTC problems,
I was experiencing them as well, but, at least in my particular case, they appear to be solved.
Problem description:
1.  Something like this:
RTC is NOT running!
2165/165/165 165:165:85
 since midnight 1/1/1970 = 1381621585s = 15990d
 now + 7d + 30s: 2013/10/19 23:46:55

Sorry for big quote.

Way back when I was learning and trying to get my alarm clock working, I had similar problems with the funny readings from the RTC.
For me it turned out to be a bad I2C connection rather than anything else.

I can't say more but it had me going nuts for a week or so.


Oh, and in case anyone else is also stuck on setting the time.....

Something else which had me going nuts when trying to do that:

I would set the times in the program and then hope/think/believe that somehow the RTC was set.

Nah!  You have to set the times in the program (and how you do that is dependant on the program/sketch) and STOP the clock, SAVE the time then RESTART the clock.

Otherwise it won't work.

That too had me stumped for a while.
9  Using Arduino / Programming Questions / Re: MATHS help reqired for HSI project. on: August 25, 2014, 06:12:51 am
Then I shall have to admit that I do not understand a word of what you are meaning.

I have "developed" my programming methods from what they were back in the 80's with BASIC and a bit of REXX to what it is now.

Alas I do see that I have become a bit "macro"/"function" mad with some of my code.

This is probably because in the early days of this, I was told that you don't write "programs" but a bunch of functions to do VERY SPECIFIC THINGS.

These send SIMPLE variables between each other to tell when they have done their job or as a result of their job.

The "bigger picture" is that all these "blocks" work as a whole to produce the desired result.

Because I have never been taught C, C++, or any other language, I am SELF TAUGHT.
I look at other's codes and TRY to understand them.

I take them apart and TRY to understand that (recursive error just happened there).

When I find code which does what I want, I try to use it - as is - to do other things.

I am lucky if I get 6 hours a week to do code.  The only real time is on the weekends.
I try to enjoy what I do and NOT waste time.

If I get stuck I ask for help.  I don't want to be spoon fed, but when I COMPLETELY don't understand what is going on, it is frustrating for me even more than you could imagine.
10  Using Arduino / Programming Questions / Re: MATHS help reqired for HSI project. on: August 25, 2014, 05:53:00 am
Ok.

I'll try it.

But don't be angry with me.

Be angry with the people with whom I got my initial help.

I can only know what I am told/taught.
NOTHING MORE.

I was not born to understand this stuff.
11  Using Arduino / Programming Questions / Re: MATHS help reqired for HSI project. on: August 24, 2014, 05:38:04 pm
PaulS,,

Well this is what is going on:

I has my code and all the numbers were declared as INT.

Someone helped me with a problem and explained that I needed to include the Z axis and showed me a formula to resolve the "correct" angles.

Alas this required FLOAT( ) which isn't compatible with INT( ) numbers (as far as I know)

My code was all written with INT( ) values.

That line put the integer value of "roll_degrees" into the variable _y for later use in the code I had written.

Yes, I am probably wrong in what I did -or there is an easier way of doing it.

That is why I am posting and asking for help.

For now I have given up on it as I am getting no where fast and I am now working on another project for a while until I can better understand what is going on.
12  Using Arduino / Project Guidance / Re: using arduino to trigger flash a unit? help. on: August 22, 2014, 10:59:11 pm
Ah, that could be part of your problem.

The opto-isolator has an LED in it, and a "receiver" which is activated by the LED.

BOTH are polartiry sensitive.  That is:  They only work if the + and - voltage are the right way around.

So the Arduino puts out a + voltage to signal the flash to ..... flash.

This goes into the "chip"/isolator/what ever, and "lights the LED".   (You can't see this of course as it is in the chip.)

The light from the LED turns on the other half and it conducts.  Or:  It acts like a short.

This is "seen" by the flash (like you shorting out the two pins) and it triggers.

BUT!   (and isn't there always one of those?)

The flash also has a + and - lead.  If they are the wrong way around, the flash won't trigger either.

So there are 4 possibilities and only one works.
I just hope you still don't have one of the three which doesn't work and that is all the problem is.

13  Using Arduino / Project Guidance / Re: using arduino to trigger flash a unit? help. on: August 22, 2014, 10:42:27 pm
(WHY are you putting a picture on "dropbox"?  You can put pictures here too - you know)

Well, you must it is the same as the one at the start of the thread.

Yeah, it looks "right".

The pins are "unknown" to me, but if that is what it says, then it is correct.

You just have to be sure of the polarity of the input (to light the LED inside) and the polarity of the output too.

14  Using Arduino / Project Guidance / Re: using arduino to trigger flash a unit? help. on: August 22, 2014, 10:30:32 pm
Ah, a bit too far away.

Good luck.

That thing from Jaycar wouldn't handle it coz of the 60v limit.

160v is nearly 3 times the limit.
(But you knew that)

smiley
15  Using Arduino / Project Guidance / Re: using arduino to trigger flash a unit? help. on: August 22, 2014, 10:20:17 pm
(wow!  Another Ozzie!)

Um, only "problem" is the max voltage.

60v.

You will need to determine how much voltage the flash puts out when it is triggered.

Where abouts are you?
(in Oz)
Pages: [1] 2 3 ... 50