Home  |  Contents 

Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: Water Level meter - How to sleep mode Post ReplyPost New Topic
Page of 2 Next >>
Author
Message << Prev Topic | Next Topic >>
Timbergetter
Newbie
Newbie


Joined: 08 October 2018
Location: Australia
Online Status: Offline
Posts: 9
Posted: 10 October 2018 at 10:23am | IP Logged Quote Timbergetter

I am putting together a project that will hopefully sense the water level in a water tank some 300 metres from my house and wireless-ly display that level value within the house. I have the following components:

2x Arduino nanos
2x HC-12 wireless
JSN-SR04T ultrasonic sensor
LMC-SSC2A16 lcd panel

I have confirmed by prototyping, that all the components work as intended, including the wireless range beyond 300 m, and I am reasonably confident that I can cobble together the sub-components into a workable system. What I am not sure about is the method to use for putting the system to sleep for most of the time, so that battery supply at the tank becomes practical. So that would involve sleeping the following:

HC-12
Ultrasonic Sensor
Nano

I think I follow the software method for shutting down the nano’s subsystems for a set time interval to achieve low average micro-amp drain. Since I need to also sleep and wake both the HC-12 and Ultrasonic Sensor I imagine that a Mosfet switch could be appropriate. I am not equipped to design a circuit for the Mosfet but given a suitable circuit diagram I could handle the assembly, even if it involved SMD components.

Any help to point me in the right direction would be very welcomed.


Back to Top View Timbergetter's Profile Search for other posts by Timbergetter
 
CaptainBoing
Guru
Guru
Avatar

Joined: 07 September 2016
Location: United Kingdom
Online Status: Offline
Posts: 626
Posted: 10 October 2018 at 11:45am | IP Logged Quote CaptainBoing

I would switch VDD for the HC-12 and Ultrasonic sensor (tie their VDD together) using a MOSFET - something like FQP30N06L. It is a TO220 package and 22A continuous across the drain/source(!) This is way more than you'll need but it is cheap and means it will provide a power feed to both devices without a heatsink - HC-12 can be juicy in high-power mode. Also, you can drive it's gate direct from a microcontroller pin. Initialise this pin as an output (lo) early in your code.

I don't know anything about SLEEPing an arduino but the process flow would be simply, wake from SLEEP, send the gate control pin hi (to feed juice to your sensor and HC-12), pause for a couple of seconds to let them stabilise, do your sample (take a few and average them), transmit the result, pausing for a couple of seconds to let it get away, gate pin lo and SLEEP... repeat.

When you get your HC-12's, buy them as a pair at the sme time. There was a thread here about a mis-matched crystal on some clones and although they were fine when used with their own kind, the mismatch meant they were incompatible with the genuine article

With your ultasonic sensor, beware there seem to be two types, one samples on demand via the trigger input and the other free-runs putting out a serial stream with a direct reading in mm- they can be very difficult to identify check through this thread about half way down.

hth

h


Edited by CaptainBoing on 10 October 2018 at 11:47am
Back to Top View CaptainBoing's Profile Search for other posts by CaptainBoing
 
ryanm
Regular Member
Regular Member


Joined: 25 September 2015
Location: Australia
Online Status: Offline
Posts: 85
Posted: 10 October 2018 at 3:28pm | IP Logged Quote ryanm

Quiescent current draw on the nano Vreg is 5mA ( from memory). Even with the 328P and radio turned off you'll get a few weeks max of a reasonably sized lipo or a few AAs.
Back to Top View ryanm's Profile Search for other posts by ryanm
 
Timbergetter
Newbie
Newbie


Joined: 08 October 2018
Location: Australia
Online Status: Offline
Posts: 9
Posted: 10 October 2018 at 7:01pm | IP Logged Quote Timbergetter

Thank you very much CaptainBoing for the heads up in my water level sensing project. I bought 4 of the HC-12 back in April 2018, right in the middle of the period when the suspect devices came to light. I’ll be using two of these so they should be matched. One day I might determine whether they are on or off spec.

The ultrasonic sensors have passed muster so far in my testing. If I encounter problems down the track I’ll follow up on your advice on two varieties.
Back to Top View Timbergetter's Profile Search for other posts by Timbergetter
 
Timbergetter
Newbie
Newbie


Joined: 08 October 2018
Location: Australia
Online Status: Offline
Posts: 9
Posted: 10 October 2018 at 7:19pm | IP Logged Quote Timbergetter

ryanm wrote:
Quiescent current draw on the nano Vreg is 5mA ( from memory). Even with the 328P and radio turned off you'll get a few weeks max of a reasonably sized lipo or a few AAs.


Thanks for you feedback ryanm. I concluded that I could get to tiny microamps in sleep mode for the Nano after viewing the following youtube video:
https://www.youtube.com/watch?v=urLSDi7SD8M
Back to Top View Timbergetter's Profile Search for other posts by Timbergetter
 
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 6128
Posted: 10 October 2018 at 7:47pm | IP Logged Quote Grogster

For sleeping the HC12, you can use your Arduino, and connect the HC12 SET line to a spare I/O on the Arduino, and use that to command the module to sleep and wake.

The other way is as CaptainBoing said - use a transistor switch. As the HC12 shares a common ground with the serial port and RF out, you need to use a high-side switch, or any other ground point will provide power to the HC12, and it could even operate on parasitic power via some resistors on the module to the 5v pin. Not enough to make the module actually work, but it could cause the module to misbehave(as it might have high-impedance power, but not enough current to actually do much, which can confuse the module).

I used a P-MOSFET and an NPN 'Helper' transistor as a high-side switch to control the 5v to the HC12. This has been documented elsewhere on the forums, but if you can't find it, I can re-upload the schematic or you can ask Mr. Google for an image of "P-channel high-side switch". To save four components(two transistors and two resistors), I just use the SET line on the HC12 now, and command it to sleep via code.

In sleep mode, the HC12 sucks about 22uA according to the datasheet.

__________________
Smoke makes things work. When the smoke gets out, it stops!
Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 
CaptainBoing
Guru
Guru
Avatar

Joined: 07 September 2016
Location: United Kingdom
Online Status: Offline
Posts: 626
Posted: 10 October 2018 at 7:58pm | IP Logged Quote CaptainBoing

Grogster wrote:
As the HC12 shares a common ground with the serial port and RF out, you need to use a high-side switch, or any other ground point will provide power to the HC12, and it could even operate on parasitic power via some resistors on the module to the 5v pin. Not enough to make the module actually work, but it could cause the module to misbehave(as it might have high-impedance power, but not enough current to actually do much, which can confuse the module).


Which MOSFET did you end up using Grogs?
Back to Top View CaptainBoing's Profile Search for other posts by CaptainBoing
 
ryanm
Regular Member
Regular Member


Joined: 25 September 2015
Location: Australia
Online Status: Offline
Posts: 85
Posted: 10 October 2018 at 8:01pm | IP Logged Quote ryanm

Only watched the first few seconds of the video, so I might be wrong, but he was using a raw 328P chip (programmed with Arduino framework). Most official arduino boards have a linear voltage regulator like a LM1117? or similar which takes 7-12v and outputs regulated 5V. This regulator itself draws power even with no load attached (Quiescent Current). So even if you pry the micro off the board a 2000mah lipo would be dead in 400 hours or a bit over a fortnight which would get annoying pretty quick.

Quick question, what's more important time or money? There's people on both sides on the forum, neither is worse than the other. You could desolder the chip and replace ( bit of fiddly work and $1) or use the nano on a mains project and get a low power board, $15-$30 maybe?
Back to Top View ryanm's Profile Search for other posts by ryanm
 
CaptainBoing
Guru
Guru
Avatar

Joined: 07 September 2016
Location: United Kingdom
Online Status: Offline
Posts: 626
Posted: 10 October 2018 at 8:49pm | IP Logged Quote CaptainBoing

you could investigate a small solar panel as a top-up. Might be enough to keep the battery going, in the ever present Oz sunshine perhaps a cheapo power-pack with built in solar panel... they are rarely man enough to charge the battery when it is getting walloped by a phone/tablet drain but with tiny draw every hour or so It might do and last overnight also. For a few $ it might provide the answer and if not then you are no further backwards.
Back to Top View CaptainBoing's Profile Search for other posts by CaptainBoing
 
Timbergetter
Newbie
Newbie


Joined: 08 October 2018
Location: Australia
Online Status: Offline
Posts: 9
Posted: 10 October 2018 at 11:05pm | IP Logged Quote Timbergetter

ryanm wrote:

Quick question, what's more important time or money? There's people on both sides on the forum, neither is worse than the other. You could desolder the chip and replace ( bit of fiddly work and $1) or use the nano on a mains project and get a low power board, $15-$30 maybe?


Neither time nor money are the main drivers now. The incentive has become the challenge to solve the problem in an interesting if not elegant way. The Nano uses the AMS1117 regulator and as you so rightly point out this has a quiescent current of 5mA. When you say to maybe “desolder the chip” I assume you are referring to the 1117. That sounds like a good way to go for my purposes. I assume that the 1117 would only be needed if you are powering the Nano with 7 to 12 volts using the Vin pin or the power plug. Alternatively I suppose I could use the ATmega32 chip and the minimal support components as used in that video, instead of a Nano or Uno. (I could program it in a spare Uno that I have).
Back to Top View Timbergetter's Profile Search for other posts by Timbergetter
 
Timbergetter
Newbie
Newbie


Joined: 08 October 2018
Location: Australia
Online Status: Offline
Posts: 9
Posted: 10 October 2018 at 11:28pm | IP Logged Quote Timbergetter

CaptainBoing wrote:
you could investigate a small solar panel as a top-up...


I did consider solar, but if most of the generated power is going into keeping the linear regulator warm rather than productive purposes then I am keen to pursue a low power solution and battery to see if that is possible. It is certainly a welcomed learning exercise for me too. In addition I think by avoiding solar I can make the system more physically robust.

It seems that Grogster has identified a problem with an n-channel device and would go with a p-channel instead. I too would be interested in the actual MOSFET that he would recommend.
Back to Top View Timbergetter's Profile Search for other posts by Timbergetter
 
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 6128
Posted: 11 October 2018 at 8:59am | IP Logged Quote Grogster

CaptainBoing wrote:
Which MOSFET did you end up using Grogs?


I used a DMP2305, which is SOT-23, and has an RDS of 90 milli-ohms at -2.5v
Vdss of -20v, Vgss of +/-8v, I=-4.2A. I helped that along with an FMMT493 NPN transistor in SOT-23.

When I did use this arrangement, I would switch the HC12 off and on when wanted. It worked fine, but using the SET line and commands in code saved me four parts. Technically in sleep, the HC12 still sucks about 22uA, but that is essentially nothing. The transistor method means the HC12 sucks no current at all when off, so if every single joule of battery energy is important, then the transistor method would still be a useful way to go.

__________________
Smoke makes things work. When the smoke gets out, it stops!
Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 


Page of 2 Next >>
In the news...
 
Post ReplyPost New Topic
Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Powered by Web Wiz Forums version 7.8
Copyright ©2001-2004 Web Wiz Guide

This page was generated in 0.1250 seconds.
Privacy Policy     Process times : 0, 0.02, 0, 0.11