Show Posts
Pages: [1] 2
1  Using Arduino / Project Guidance / Re: Feasibility for wireless communication between multiple Arduino on: July 22, 2013, 05:38:26 am
I'd also have a look at Jeenodes.

Arduino compatible, with built in RFMB12 wifi :-)
2  Using Arduino / Sensors / Re: DS1388 RTC on: February 13, 2013, 11:50:11 am
Great when it all works  smiley

Cheers,

David
3  Using Arduino / Sensors / Re: DS1388 RTC on: February 12, 2013, 06:32:20 pm
I think isrunning() is something in the ladyada fork of jcw's lib, but never got put back into the original jcw one...  Which is a pity.

I've added it back into the pull request I sent smiley
4  Using Arduino / Sensors / Re: DS1388 RTC on: February 12, 2013, 04:29:49 pm
Fork created, changes added, pull request sent :-)

https://github.com/davidmpye/rtclib

David
5  Using Arduino / Sensors / Re: DS1388 RTC on: February 09, 2013, 09:10:18 am
Oh, and another problem I found with the DS1388.

It's very sensitive to any crystal instability, so touching the contacts of the crystal while it's running is enough to upset it and make isRunning() return false.

Problem fixed by coating those pins and the short length of track between them and the ds1388 with hot glue. Solved :-)
6  Using Arduino / Sensors / Re: DS1388 RTC on: February 09, 2013, 09:09:25 am
Great!

I will try to figure out how github works (I was used to cvs in the past!) and am a bit out of date w.r.t. modern source control!

I will send a patch for my changes to isRunning, and adjust().   

Cheers,

David
7  Using Arduino / Sensors / Re: DS1388 RTC on: February 04, 2013, 06:43:20 am
Hi elpaso,

If you're happy to fork the lib and add your changes, I can add mine on top.  Be interested to see what else you did :-)

Cheers,

David
8  Using Arduino / Sensors / Re: DS1388 RTC on: January 31, 2013, 03:18:06 pm
Ooh, that'd be interesting!

Take ownership, as in the Arduino project taking ownership?

I could hack the code into some semblance of order certainly, but I'd not have the time to 'maintain' it separately outside the Arduino family.

David
9  Using Arduino / Sensors / Re: DS1388 RTC on: January 31, 2013, 02:26:37 pm
Thanks!

I did wonder whether it might be better to adjust the class heirarchy a bit, and have a core DSRTC class, with two subclasses (DS1388 and DS1307) etc to improve code re-use.

One problem I've found with some libraries like the DS1307 is that it isn't maintained in simply one place.  I wonder if the arduino 'core' project team has considered adopting it like the I2C libraries etc?  If so, it'd be clear who owned it, and therefore who to submit patches to.

Any thoughts ?   smiley
10  Using Arduino / Project Guidance / Re: Blood Pressure system on: January 30, 2013, 07:00:22 pm
See if you can make it work with an irregular heartbeat, the ones I work with don't manage that very well!

Another way to get the info of course, is to hack into your existing monitor, if that's an option ;-)
11  Using Arduino / Project Guidance / Re: Blood Pressure system on: January 30, 2013, 06:48:53 pm
Have a look at op-amps for your voltage amplification requirements.

It'll be a little bit of a learning curve but that will point you in the right direction.

From the blood pressure point of view, I'm curious to know how you will figure out the systolic and diastolic pressures - are you hoping to look at the pulse variations?

I don't suppose the reference voltage issues will matter, because provided your amplifier only goes up to 3.3v, then that will be the highest you can read (provided the op amp supply voltage is the same 3.3 volt supply that is fed into the AREF).

12  Using Arduino / Sensors / Re: DS1388 RTC on: January 30, 2013, 04:40:05 pm
Watchdogs then!

My circuit has the arduino in a deep sleep, woken up every 60 seconds by the RTC interrupt, which then does some logging, and goes straight back to sleep.  Nearly ripped my hair out trying to find out why this didn't work the way I wanted.

Here's what I learnt:

To initialise it in the first place the data sheet says it needs to be disabled before you can write to the watchdog time registers, then re-enabled.

Code:
  //Disable the RTC watchdog first.
  Wire.beginTransmission(0x68); 
  Wire.write(0x0c);
  Wire.write(0x00); 
  Wire.endTransmission();

  //Set the watchdog timer to 60 seconds
 Wire.beginTransmission(0x68);
  Wire.write(0x08);
  Wire.write(0x00);  //08h   
  Wire.write(0x60);  //09h - time 60 seconds
  Wire.write(0x00);  //0ah
  Wire.write(0x00);  //0bh - clear the triggered bit.
  Wire.endTransmission(); 
   
  //Enable the watchdog timer in the RTC.  0x0c -> 0x03 (WDE and WDE/RST)
  Wire.beginTransmission(0x68);
  Wire.write(0x0c);
  Wire.write(0x03);
  Wire.endTransmission();

  attachInterrupt(1, onWake, RISING);   //here's my interrupt handler.


Once it wakes you up, you need to do the following to make it go off in another minute - if you don't, it will never fire again!
You need to re-specify the time, and clear the 'triggered' bit in the 0x0b register, then you can safely sleep, and it will wake you in another 60 seconds  smiley

Code:
  //Reset the watchdog timer
  Wire.beginTransmission(0x68);
  Wire.write(0x08);
  Wire.write(0x00);  //08h   
  Wire.write(0x60);  //09h - time 60 seconds.
  Wire.write(0x00);  //0ah
  Wire.write(0x00);  //0bh - clear the triggered bit.
  Wire.endTransmission();
13  Using Arduino / Sensors / Re: DS1388 RTC on: January 30, 2013, 04:35:37 pm
Hi,

For anyone else stumbling across this topic, I've got a few pieces of info I've learnt from using the DS1388 with an arduino.

Firstly, you need to change isRunning, because the register in question is in a different place!

Secondly, you need to change the adjust code to actually clear the 'time invalid' flag.

There's also some watchdog issues if anyone uses those, which I will post separately.

So, here are my 3 modified functions, adjust(), isRunning() and now()

Code:
uint8_t RTC_DS1307::isrunning(void) {
  Wire.beginTransmission(DS1307_ADDRESS);
  Wire.write(0x0b);
  Wire.endTransmission();

  Wire.requestFrom(DS1307_ADDRESS, 1);
  uint8_t ss = Wire.read();
  return !(ss>>7);
}

void RTC_DS1307::adjust(const DateTime& dt) {
    Wire.beginTransmission(DS1307_ADDRESS);
    Wire.write(i);
    Wire.write(bin2bcd(0)); // hundreds of seconds 0x00
    Wire.write(bin2bcd(dt.second())); // 0x01
    Wire.write(bin2bcd(dt.minute())); // 0x02
    Wire.write(bin2bcd(dt.hour())); // 0x03
    Wire.write(bin2bcd(0)); // 0x04
    Wire.write(bin2bcd(dt.day())); // 0x05
    Wire.write(bin2bcd(dt.month())); // 0x06
    Wire.write(bin2bcd(dt.year() - 2000)); // 0x07
    Wire.endTransmission();

Wire.beginTransmission(DS1307_ADDRESS);
Wire.write(0x0b);
Wire.write(0x00); //clear the flag bit (OSF)
Wire.endTransmission();
}

DateTime RTC_DS1307::now() {
  Wire.beginTransmission(DS1307_ADDRESS);
  Wire.write(i);
  Wire.endTransmission();

  Wire.requestFrom(DS1307_ADDRESS, 8);
  uint8_t hs = bcd2bin(Wire.read() & 0x7F);  // hundreds of seconds
  uint8_t ss = bcd2bin(Wire.read() & 0x7F);
  uint8_t mm = bcd2bin(Wire.read());
  uint8_t hh = bcd2bin(Wire.read());
  Wire.read();
  uint8_t d = bcd2bin(Wire.read());
  uint8_t m = bcd2bin(Wire.read());
  uint16_t y = bcd2bin(Wire.read()) + 2000;

  return DateTime (y, m, d, hh, mm, ss);
}
14  Forum 2005-2010 (read only) / Development / Re: New MCP23017 library! on: October 22, 2010, 02:30:53 pm
MCP23017 buttonMux(0x00); // Assuming the three address pins are all 0
buttonMux.init();

You can use the arduino like syntax of:
buttonMux.pinMode(0,  INPUT);
int result = buttonMux.digitalRead(0);

//result now contains the state of pin number 1.

to set pins one at a time.  Alternatively, there are functions more like the options in the MCP23017 data sheet.

Have a look at the .h file - it explains each of the functions.  There are ones that function like arduino ones - pinMode, digitalRead, digitalRead if you want to work on individual pins, or there are functions to let you read words rather than pins one at a time - up to you!

David
15  Forum 2005-2010 (read only) / Development / Re: New MCP23017 library! on: December 30, 2009, 05:34:29 pm
I pondered exactly what my thoughts on this were before I decided on the GPL for this library.

My opinion is that a) sharing code is good b) if I hadn't shared my code, there wouldn't be a library in the first place, so it seems a fair trade that if people want to use it they should share also.

It's also worth highlighting one thing here:  You only have to share your source *if* you distribute your binary (or arduino-programmed devices) - I cant turn up and demand the source for your homebrew weather station because you used my library unless you distribute it.

I would consider making it available under the LGPL if it would be included in the arduino base libraries if that were a requirement - otherwise I think I'll probably leave it under the GPL.  If somebody had a particularly strong reason for requesting it to be made available under another licence, I would consider it on an individual basis.

On another note, I was rather disturbed by the lack of licencing headers on the library source code - it would be much more reassuring if these had the LGPL (or appropriate licence) headers on so people knew exactly what licences they were made available under.

Cheers,

David

Pages: [1] 2