I asctually have a problem because my circuit is using to much power (10mA in sleep mode)
I suspect the my SeeSaw board Overview | Adafruit seesaw | Adafruit Learning System is the cause. My sensor must be powered only when a measure must be taken. otherwise, during 59mn, the board sleep.
I only have 1 pin free of 3.3V in my AMD21 microcontroller.
I wonder if I could use PWM to define a instruction.
For example, if I code
analogWrite(pin, 0) // All sensors are not power
analogWrite(pin, 1) // sensor 1 is powered
analogWrite(pin, 2) // sensor 2 is powered
analogWrite(pin, 3) // sensor 3 is powered
analogWrite(pin, 4) // sensor 4 is powered
analogWrite(pin, 5) // sensor 5 is powered
analogWrite(pin, 6)
I could use the gate of the transitor to power the sensor the the gate is closed.
But I have no idea, how I could read the out put pin value and how I could power ON or OFF, one sensor at time.
Would you have any siggestion to program my micrcontroller for this?
But from this point, I have no idea how I could
Read the value
pierrot10:
I wonder if I could use PWM to define a instruction.
I don't see how that could work unless you use another microprocessor to interpret the output from the analogWrite().
Would it work to switch all the sensors on or off at the same time - you could do that with one I/O pin. It may not be as economical as switching them individually, but it may be a big improvement on not switching them off ever.
Yes, but I have 3 tensiometric moisture sensor and my micro controllor does have enough power to power the 3 at the same time. The other are I2C which does not required a lot of power...
The idea is to use a transistor (or a CMOS)and when the gate is closed, one mositure sensor is powered, and etc.
The difficulty is, I have one pin to manage the sensors power.
As with PWM we can modulate the width of the pulse, my idea is use a width pulse to indicate which transistor must be powered, but how?
pierrot10:
As with PWM we can modulate the width of the pulse, my idea is use a with pulse to indicate which transistor must be powered, but how?
With another Arduino that can detect and time the pulses to measure the widths.
By the way I reckon it would be difficult to distinguish reliably between analogWrite(pin, 1) and analogWrite(pin, 2) etc. I think you would need bigger gaps such as analogWrite(pin, 50) analogWrite(pin. 100) etc
Maybe it is worth considering a wider distribution of tasks between two Arduinos?
Maybe it is worth considering a wider distribution of tasks between two Arduinos?
Yes, that a good point of view. I though about that.
But I am not aware about is how to transfer the data (sensor value) between microcontroller with I2C or Rx and Tx. (may be Rx and Tx would be the best)
The second idea was:
The first µcontrollor wake up and wake up the second
The second powers the sensors altenatively and get the value
The second µcontroller send the values to the first and goes to sleep
The first µcontroller send the value with LoRA (and manage the LCD, the LEDs, the RTC module, and may be some I2C sensors
pierrot10:
But I am not aware about is how to transfer the data (sensor value) between microcontroller with I2C or Rx and Tx. (may be Rx and Tx would be the best)
Serial communication has the advantage of familiarity. It also has the benefit that you can easily test the communication with either board on its own using the Arduino Serial Monitor.
I2C or SPI are short range mechanisms - distances measured in centimetres. I have never used I2C but SPI is straightforward.
Vce will not be zero volts being supplied to the sensor devices, consider the effect upon the sensors not having a zero volt reference.
Also, if the xsistor is cut off your sensors will feel max V.
It may be better to use a MOSFET and to cut power to the devices instead of circuit common. I'd, also, use a cap to the sensor supply to cause the voltage to the sensors to rise instead of suddenly appear when power is supplied.
As well, the sensors may need some time after power on to do their own power on reset routines and the sensors may loose their settings with power interrupted.