Author Topic: Need some guidance for a simple remote control please.  (Read 973 times)

doublec4

  • Jr. Member
  • **
  • Posts: 50
Need some guidance for a simple remote control please.
« on: November 07, 2017, 10:05:30 PM »
Hi everyone, I came across the Moteino and it sounds like the perfect module for my application... I've been using different Arduinos for a while but I don't have any experience with RF devices. I'm hoping some of you might be kind enough to provide me with some guidance.

I'm looking to build a very simple remote control using Moteino. Here are my requirements:
- It will be operated inside of a car where the receiver will be in the trunk. Distance should only be 10-15ft maximum.
- Low power... I am hoping to run the remote off of a coin cell or a AAA and hopefully it will last a year minimum.
- The remote has four buttons and two LED lights. The four buttons send a command back to the receiver. The receiver can send a confirmation (first LED blink) or an error (second LED blink) back to the remote.

This is probably simple for most of you, but I am curious about a power saving / sleep strategy for this type of device. I tried to read through some of the stickied threads about power saving modes but I admit, I got a little lost in it all.

I was thinking that the remote would be asleep most of the time (when the vehicle is off). When the vehicle is turned on, the receiver, which is hard wired into the vehicle would turn on and send a command to wake up the remote. Then when the vehicle is turned off, the receiver would send a signal to the remote to go to sleep. This seems reasonable to do, correct? Is this something that can be done with the "listen" function I think I read about?

Trying to take power saving one step further, I was wondering if I could just have the remote asleep all of the time... and it only wakes up when a button is pressed or an error status is sent back to the remote to flash one of the LEDs. What confuses me is that I think waking the device would have to be done with some kind of interrupt? If this is true, only one pin can be used as an interrupt with the Moteino? In this case, how do I make multiple events all tie into one interrupt pin to wake it up and then process accordingly?

I apologize if this seems trivial but any help would be really appreciated!  :-[

Thank you!




TomWS

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1853
Re: Need some guidance for a simple remote control please.
« Reply #1 on: November 07, 2017, 10:17:15 PM »
What does the device in the trunk do when the remote buttons are pressed?

doublec4

  • Jr. Member
  • **
  • Posts: 50
Re: Need some guidance for a simple remote control please.
« Reply #2 on: November 07, 2017, 10:39:45 PM »
The buttons would tell another arduino to "turn on" some mosfets for switching some hydraulic solenoids.


Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5681
  • Country: us
    • LowPowerLab
Re: Need some guidance for a simple remote control please.
« Reply #3 on: November 08, 2017, 08:31:18 AM »
Some thoughts..

If you need coin cell or dual AAs then you can use the 8mhz Moteino, I would recommend the CW-915 radio, should be enough for your needs.
If it's 1 way comm (remote to receiver) then it's much simpler. If the receiver sends data randomly back then you will need to use listen mode. In a car you should have simple power access though so if that's an option then the amount of work is much less (coding wise especially I think).
You can use PCINT interrupts and TomWS is the expert on that topic, there are some threads about that in the forum - essentially there are 2 hardware interrupts (that means dedicated interrupt handler function in code) on the 328p - one is used by the radio (D2), one is available for general use (D3). If you need more, then you can use PCINT (pin change interrupts) and then you just need to check which pin was asserted after wakeup, the libraries available might make that easy, it's been a while since I used PCINT.

You haven't mentioned if the receiver is permanently powered so assumption is that is not a problem.

Overall I think the whole complication is around having permanent power or not. That defines whether your remote can just listen in RX all the time or have to use a power saving scheme like listen mode (RX for a fraction of the time, sleep the rest).

doublec4

  • Jr. Member
  • **
  • Posts: 50
Re: Need some guidance for a simple remote control please.
« Reply #4 on: November 08, 2017, 11:58:00 AM »
Thanks for the reply Felix (awesome product by the way).

The battery power for the remote is more about convenience and aesthetics. Although power is readily available in the car, the space to "hard mount" a remote is difficult to come by (and not many people like cutting into their cars). Not to mention one size fits all is impossible. Even having to power from a USB cable is a little unsightly in my opinion... so I'm trying to make battery power work if possible. Also, I failed to mention that I was really hoping to use the Moteino with the trace antenna... no wire antenna looks slick :)

The receiver end will be hard wired as it will be hidden away in the trunk and therefore power savings are not a concern. I'll just put the receiver to sleep with the vehicle off so there is little parasitic drain on the car battery. When the accessory power is turned on in the car, this event will wake the receiver.

I will do more research on the listen mode + the PCINT as suggested.

As you mentioned, the power savings strategy will be the most difficult part of this I imagine. I came across this site that had some tricks for power saving (some relevant, some not):

https://www.gammon.com.au/forum/?id=11497

I'm excited to order some Moteinos and start tinkering and learning more about RF communication!




TomWS

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1853
Re: Need some guidance for a simple remote control please.
« Reply #5 on: November 08, 2017, 03:30:05 PM »
You shouldn't need to use listen mode in your application.  The receiver in the trunk will draw 10's of milliamps while in RX mode which won't even be noticed by your automobile power source while running.  It's not worth trying to save power in this case and, in the power off case, there's no power required so no quiescent drain.

The remote can easily be powered from a CR2032 battery or a small LiPo if you want to make it rechargeable.  The pin change interrupt should work well for you.  When not pressed, the entire remote is in deep sleep state drawing single digit uA when only waiting for a pin change.  You could go even lower if you include power switching based on switch pressed - a switch press turns it on and it stays on until your remote code triggers the 'done' condition which powers the remote off again.  In this case you don't even need a pinchange interrupt - the fact that the remote has been powered up will be enough to look at the switches.  The quiescent current in this case is nanoAmps.

Take a look at the TPL5110 breakout that Felix offers.  I'm pretty sure it can operate in a mode that does exactly this.

Tom

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5681
  • Country: us
    • LowPowerLab
Re: Need some guidance for a simple remote control please.
« Reply #6 on: November 08, 2017, 04:22:10 PM »
From my understanding his remote needs to listen for error codes or other instructions from the receiver (powered) trunk node. Hence my mention of listen mode.
But otherwise to just wakeup the remote only when user action (button press) happens, that is very easy and like Tom said, you could even get by without PCINT if you want to use a watchdog chip.

Or how about using the hardware interrupt wired to all switches, then each switch to another GPIO, so in the interrupt routine (happens when any switch pressed) you do a digitalRead of each switch to figure out which was pressed and take it from there. Maybe this would work if you dont want to mess with PCINT.

But anyway it sounded like you want the remote to receive signals which automatically means listen mode at the very least.

doublec4

  • Jr. Member
  • **
  • Posts: 50
Re: Need some guidance for a simple remote control please.
« Reply #7 on: November 08, 2017, 10:06:59 PM »
Thanks again guys.

Okay so Tom, you're right. There is no need for my trunk node to sleep. For some reason I was thinking of putting it to sleep with the vehicle off, but there is really no point. I can just use a "hot with ignition on" wire from the vehicle connected to the gate of some kind of transistor and turn the whole trunk board on and off this way. So no need for listen or anything like that for the trunk node. Not to mention I do not want this device to operate with the vehicle turned off so this would eliminate that possibility.

Felix is right about my remote needing to listen for error codes from the trunk node. Basically I will have a few pressure sensors connected to the Arduino in my trunk. If hydraulic pressure is detected when it is not supposed to, I would like a message sent to the remote so that the "Error" LED begins to flash. Therefore, the remote should sleep at all times, and wake on either a button press (any of the four buttons) or an error message from the trunk node.

I like the idea of using all buttons wired to the hardware INT and then to each their own GPIO. Seems simple enough and I should have more than enough IO pins available. OR multiple buttons can be handled by one analog pin with a set up like on this LCD button shield: https://github.com/CainZ/LiquidCrystal/raw/master/LCD%20Keypad%20shield%20v2.0.pdf
From my understanding an analog pin can be used as an interrupt and then it would just take the reading and know which of the buttons was pressed.

As for the second condition where the error message wakes the remote, this would call for the listen mode then it seems... Is there any issue with using both listen and the hardware INT to wake the remote? Or can I only have one or the other?

I checked out the watchdog chips... correct me if I'm wrong but these will produce timed wake/sleep cycles? So unless I need something to happen at a specific interval, this probably won't work for me? I'm not seeing how the TPL5110 will power it off indefinitely until a button is pressed...

Thanks again guys, this discussion is helping me sort out my thoughts
« Last Edit: November 08, 2017, 11:46:19 PM by doublec4 »

TomWS

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1853
Re: Need some guidance for a simple remote control please.
« Reply #8 on: November 09, 2017, 12:11:10 PM »
If hydraulic pressure is detected when it is not supposed to, I would like a message sent to the remote so that the "Error" LED begins to flash. Therefore, the remote should sleep at all times, and wake on either a button press (any of the four buttons) or an error message from the trunk node.
If the pressure check doesn't need to be done until the remote wants to send a command to the receiver, then you could send the pressure status in the Receiver's ACK.  If you need constant monitoring, then, yes, you probably need to implement this with Listen Mode.  Bear in mind that Listen Mode has its share of problems, and this will be especially true in a electrically noisy environment like an automobile.
Quote
I checked out the watchdog chips... correct me if I'm wrong but these will produce timed wake/sleep cycles? So unless I need something to happen at a specific interval, this probably won't work for me? I'm not seeing how the TPL5110 will power it off indefinitely until a button is pressed...
Check out 'One Shot' mode of the TPL5110.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5681
  • Country: us
    • LowPowerLab
Re: Need some guidance for a simple remote control please.
« Reply #9 on: November 09, 2017, 12:17:52 PM »
I would also strongly suggest to look into other ways of working around status messages. If at all possible, like Tom mentioned, try to get any updates during the ACK (after remote sends data to always ON receiver).

doublec4

  • Jr. Member
  • **
  • Posts: 50
Re: Need some guidance for a simple remote control please.
« Reply #10 on: November 09, 2017, 11:49:42 PM »
I can work with that. The pressure check is to check for residual pressure in the lines after the user presses a button to drain the lines. Residual pressure indicates that the line has not been properly relieved.

Currently (with my project hard wired - no wireless remote) the button press activates a solenoid to drain the line. This takes roughly 10 seconds, and then the pressure check is made. As long as the update can be checked ~10 seconds after the drain command is sent to the receiver then this could be the solution.

TomWS

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1853
Re: Need some guidance for a simple remote control please.
« Reply #11 on: November 10, 2017, 08:18:55 AM »
If you can go to listen mode for a relatively narrow period of time (10-20 seconds) and then go to a button interrupt sleep mode for the bulk of the time, this should work for you and get decent battery life.  Note that there isn't much short term capacity in a coin cell and it will drain very quickly so limit on time and keep transmissions short.  Bulk capacitors may help but you need to keep your BOD settings low (or off) to prevent premature resets.

Tom

doublec4

  • Jr. Member
  • **
  • Posts: 50
Re: Need some guidance for a simple remote control please.
« Reply #12 on: November 13, 2017, 10:14:41 AM »
Thanks again,

Just placed an order for my Moteinos! (Regular and Mega)

I'm sure I'll have more questions along the way :)