Show Posts
Pages: 1 ... 5 6 [7] 8 9
91  Using Arduino / Project Guidance / Re: Sleep and Millis() - I need both? on: August 01, 2012, 03:57:18 pm
There are power management libraries which can perform the sleep and maintain the 'millis()' value correctly, which simplifies your sketch.

I have not seen any - the only mode that maintained the millis function was SLEEP_MODE_IDLE when I did some testing.

But in this mode there is not much power savings since the processor wakes up every millisecond.

All other modes I tried the millis() had stopped.

chris
92  Using Arduino / Project Guidance / Re: Sleep and Millis() - I need both? on: August 01, 2012, 04:26:13 am

Why not have the receiver timestamp the data?  Why does the sender have to do it?


I guess this could work but if I lost a packet instead of a gap I would have corrupt data.

I will look into this option as well.

cheers

chris
93  Using Arduino / Project Guidance / Re: Sleep and Millis() - I need both? on: August 01, 2012, 04:24:55 am
Why not sleep, use RTC's square wave output as an interrupt to wake up more often than once a second? Check the time, if not ready to send yet go back to sleep, check again.
You have these choices with a DS1307 for example:
1 Hz, 1000mS
4 KHz, 0.250mS
8KHz, 0.125mS
32kHZ, 0.03125mS

4 KHz seems like plenty, keep track of where you are within the second using that.
Wake up increment time interval counter, see of power pulse occurred yet.
Waking up every 250uS, or 4000 clocks, I guess you'd stll be sleeping most of the time.



This sounds interesting - have you actually used the interrupt to count time?

It does not matter when I update the data - 60 seconds, 61 seconds etc.... But I need to know how long since the last update to get accurate data durations for the pulse count.

Are you saying with this interrupt I could increment a volatile variable and simulate my own millis function?

Chris
94  Using Arduino / Project Guidance / Sleep and Millis() - I need both? on: July 31, 2012, 11:48:28 pm
I am creating a project that needs to save power - both battery and my house power.

I am creating a simple circuit using an ATMega328 + a few components to count the pulses from a power meter.

The device must run on batteries and about once per minute send a small payload via 2.4Ghz

My data packet I send is

TimeNowMS
TimePrevMS
PulseNow
PulsePrev

So based on this I can work out the power consumption in my house at the current time.

I have the basics working but I now want the device to sleep between updates over WIFI to save power.

I need to have the pulses being counted using interrupts even when sleeping.

Without any sleep the board is using 19ma - I want to reduce that by a huge amount - remember this is not an arduino board just the bare essentials to get it running with arduino code.

All of the arduino sleep modes of any value corrupt the value returned by Millis() since the timer is not running when the device is sleeping.

Normally I count the pulses between updates and also the duration in ms since the last update in ms.

I thought about a RTC but 1 second accuracy is not good enough - I need more accuracy !

Is there a way I can use a crystal to get ms? maybe using some sort of external circuit? but still readable by Arduino and all the while not using much power?

ANy thoughts appreciated

chris

95  Using Arduino / Programming Questions / Re: Arduino and Sleep - power save on: July 31, 2012, 02:22:13 pm

Thanks Nick

That helped me a lot.

chris
96  Using Arduino / Programming Questions / Re: Arduino and Sleep - power save on: July 31, 2012, 03:37:56 am
Which version of the IDE are you using?

On that computer it is 1.01

Chris

97  Using Arduino / Programming Questions / Arduino and Sleep - power save on: July 31, 2012, 02:51:41 am
I am trying to follow the code at http://jeelabs.org/2009/05/16/power-consumption-more-savings/

I think I have it right - but I am getting some strange Serial output.



My code is

Code:
#include <avr/interrupt.h>
#include <avr/power.h>
#include <avr/sleep.h>
#include <avr/wdt.h>

ISR(WDT_vect) {
}

void setup()
{
  Serial.begin(9600);
MCUSR &= ~(1<<WDRF);
cli();
WDTCSR |= (1 << WDCE) | (1 << WDE);
WDTCSR = 6;
WDTCSR |= bit(WDIE);
sei();

}

void loop()
{
  delay(3);
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  sleep_mode();
  Serial.print ("\nBMP");
}



Any ideas of why I get corrupted data on the Serial Output?

I am using an Arduino Duemilanove

Chris
98  Using Arduino / Sensors / Re: ROPE Water Sensor on: July 30, 2012, 04:38:43 pm
I did find a site that creates and sells the cable.

I have asked for some pricing options.

http://www.cmrelectrical.com/water-detection-cable.htm

I think this works differently, in that it does not tell you where along the cable it is shorted but just that there is a detection.

Chris
99  Using Arduino / Networking, Protocols, and Devices / Re: RF24 - nrf24l01+ - scanner example on: July 29, 2012, 09:28:46 pm
Thanks John

Chris
100  Using Arduino / Networking, Protocols, and Devices / RF24 - nrf24l01+ - scanner example on: July 29, 2012, 06:39:44 pm
I am looking at the scanner example from the RF24 Library.

The example is here:

http://maniacbug.github.com/RF24/scanner_8pde-example.html

Can someone explain to me what I should be seeing?

From the code if it detects a carrier it increments a counter for that channel.

So is a carrier bad? ie there is some other wifi device on that channel?

Do I want to use a channel for my code which has a value of 0?

Chris
101  Using Arduino / Sensors / ROPE Water Sensor on: July 29, 2012, 01:55:03 pm
Hi

I have been getting interested in Rope Water Sensors which can detect when any part of the rope is wet and then using an Arduino to process that and generate an alert. Good for server rooms or anywhere you do not want water.

These things are made (or sold) by a lot of companies but they all include the electronics.

A quick  google will show you what I mean

http://www.google.com/search?q=Rope Water Sensor

I am interested in just the cable - anyone know who makes this cable and sells it online?

I am in New Zealand but it could be imported i assume?

Cheers

Chirs
102  Using Arduino / Networking, Protocols, and Devices / Re: NRF24L01 problems - Beginner - Not working on: July 26, 2012, 05:57:46 pm
OK

I decided to try to run a different sketch - in this case another example - I think it was pingpong?

This worked for me.

No idea why the "getting started" sketch did not but I will try to see over the weekend - work calls now!
103  Using Arduino / Networking, Protocols, and Devices / Re: NRF24L01 problems - Beginner - Not working on: July 26, 2012, 02:43:20 pm
OK I think I am better now but still not successfully transmitting/receiving.

I am getting what looks to be better data on the debug output from the radio now



The error  I get is timeout when sending a packet.

Now I am unsure about the radio pipe addresses

// Radio pipe addresses for the 2 nodes to communicate.
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };

Are these some sort of hardware device id? or are they just created as random numbers?

If they are hardware ids then they look like the RX_ADDR_P0-1 from the screen snap above but the numbers are different in this case.

I tried using those numbers in this area but I still got the same timeout message!

Any ideas?

Chris
104  Using Arduino / Networking, Protocols, and Devices / Re: NRF24L01 problems - Beginner - Not working on: July 26, 2012, 01:52:44 pm
Thanks for your reply as it may have put me on the right track.

On an Arduino Duemilanove

SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK).

On an Arduino Mega 2560

SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS).

Also on the docs for Arduino Mega 2560 it says "The SPI pins are also broken out on the ICSP header, which is physically compatible with the Uno, Duemilanove and Diecimila."

So I have my connections on the wrong pins (as I am using Mega Boards) - I did a quick search for the ICSP header and found this image and page



ref: http://www.instructables.com/id/Adding-ICSP-header-to-your-ArduinoAVR-board/step3/ICSP-header-pinout/




I am about to go change my pins and test...

Chris
105  Using Arduino / Networking, Protocols, and Devices / Re: NRF24L01 problems - Beginner - Not working on: July 25, 2012, 11:16:12 pm
OK I have found that the constructor specifies the CE and CS pins - I take it CSN is CS?

Here is the constructor

RF24::RF24 (uint8_t _cepin, uint8_t _cspin )

Constructor.

Creates a new instance of this driver. Before using, you create an instance and send in the unique pins that this chip is connected to.

Parameters:

_cepin

The pin attached to Chip Enable on the RF module

_cspin

The pin attached to Chip Select


I have changed the constructor to

RF24 radio(8, 9);


But I still have no joy - here is a pic of the board with the pin outs (as I noticed some are different)



Chris
Pages: 1 ... 5 6 [7] 8 9