@xCite86 hey Xcite, I do not have that much experience with arduino. What i did now is added your piece of code to MySensors Motion sensor code and uploaded it the Mini. Do I now need to connect something to pin 13 or how do i read out this data in the Arduino IDE?
-
[TIPS] battery powered sensors
-
@Anduril, Thank you. for the headsup. I did the check this morning and come up with the following
@xCite86, fourth setup, removed PowerLED, removed VoltageRegulator, 1mHz-Mod
- 1mhz, 3,3V, noLed // 0,73mAh
- list item1mhz, 3,3V, brightLed // 1.8 mAh
So compared to the data of @xCite86 it is functioning on the 1mHz Mod and in comparison to him. So my problem is there when i attach the motion sensor(HC SR-501) and Radio (NRF24L01+) somehow this will increase my power consumption dramaticly and i can seem to get the arduino in combination with the Antenna into sleep to save my batteries
-
- 1mhz, 3,3V, noLed // 0,73mAh
- list item1mhz, 3,3V, brightLed // 1.8 mAh
I suppose you mean 0.73mA current and not a capacity of mAh. I don’t have measurements for my own setup, but it seems reasonable as it is not sleeping. Having a current of 3.5 mA as you wrote above also seems ok to me. Did you measured this when the arduino was awake or in sleep mode? Could you please upload your sketch so we can see how you implemented sleeping?
I have a testing node for battery reporting temp/hum/bat every 30 seconds and battery dropped only few percent during a whole week. When increasing sleeptime to 5 or 10 minutes battery life will be reasonable long.
-
@Anduril Sorry ofcourse i meant mA. The code I use for the Motion sensor is the standard code from Mysensors adjusted that the sleep time is a hour instead of 2 minutes.
* The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * REVISION HISTORY * Version 1.0 - Henrik Ekblad * * DESCRIPTION * Motion Sensor example using HC-SR501 * http://www.mysensors.org/build/motion * */ // Enable debug prints // #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #include <SPI.h> #include <MySensors.h> unsigned long SLEEP_TIME = 3600000; // Sleep time between reports (in milliseconds) #define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!) #define CHILD_ID 1 // Id of the sensor child // Initialize motion message MyMessage msg(CHILD_ID, V_TRIPPED); void setup() { pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Motion Sensor", "1.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID, S_MOTION); } void loop() { // Read digital motion value boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; Serial.println(tripped); send(msg.set(tripped?"1":"0")); // Send tripped value to gw // Sleep until interrupt comes in on motion sensor. Send update every hour. sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME); }
This is the code i used.
-
That code looks good. Could you please check 2 things:
First dissable sleep commend with // (and send command to avoid sending all the time) and connect nrf and pir. This way you can measure the current of the curcuit when awake.
Next could you please upload a sketch with only sleep command without interrupt, so only sleep(sleeptime); and everything connected. This way you can measure sleep current of your setup.
Maybe there is an issue with the interrupt and the arduino not sleeping correctly. -
Could you also switch on debugging messages so you can see what’s happening?
Perhaps the connection is not so good and it is resending often -
@TVN
Can you please tell us where the issue was? I think it can be helpfull for other users. -
How do i upload a skethc to an arduino pro mini that has the 1mhz bootloader?
I uploaded the bootloader with arduino as isp via IDE. This worked fine.
But now when i want to upload a sketch using my programmer i cannot get a sketch on the board. -
you shouldn’t use the programmer, than it will program the isp-arduino.
you can just use the normal way to program the mini, so via an ftdi. Don’t forget to set the board type to 1mhz -
Excuse me, i tried to upload the sketch with an ftdi programmer, and i did set the board to 1mhz type
-
is the baudrate set correctly in the board txt?
-
I copied the settings posted in the first pist of this thread
-
and the ISP arduino was disconnected? What error messages do you get?
-
Yes it was disconnected from the isp…
I don’t see anything uploading. No rx and tx on the programmer. Programming takes way too long… do not know the exact code -
I guess you remembered to change back the USB port after programming the bootloader? It seems obvious but it can be confusing.
-
did you also remove the power regulator on your pro mini?
In that case you can’t use the vcc of the programmer anymore and you have to power you pro mini with batteries during flashing I think (also see https://forum.pimatic.org/topic/383/tips-battery-powered-sensors)
-
Hi,
I’m trying to build a wireless battery powered sensor with an arduino pro mini 3.3V/8MHz + NRF24L01
I buy a rechargeable coin battery LIR2032 3.6V
But the voltage is upper than 3.3V or 3.6V (actually 3.9V but I read it can be above 4V when fully charged and must be charged at 4.2V)What is the voltage limit of the arduino mini pro 3.3V on Vcc pin? (I want to remove the regulator to spare some uA so I don’t use RAW pin)
I saw that for the NRF24L01 the limit is about 3.6V… So I read this article and try to find some cheap low current LDO (only for the NRF) but I wonder if there is not simpler solution somebody success to? (Diode, pwm?)
Sorry for my poor English, thank you for reading.