USB power related issue

Hello, If usb port is disabled for mass storage devices will Adrunio work when connected with usb power ? and why after some time Adrunio goes offline when powered with usb. how to keep Adrunio online 24/7 from usb.

2, Can we send ir-commands to tv on off without usb being connected to PC and com port?
my ir command are working with USB connected with serial communication but Arduino goes offline so and command can't be send from com ports.

Thanks

If usb port is disabled for mass storage devices will Adrunio work when connected with usb power ? and why after some time Adrunio goes offline when powered with usb. how to keep Adrunio online 24/7 from usb.

If the power lines of the USB connection are maintained by whatever device is supplying the power then the Arduino will remain powered.

Can we send ir-commands to tv on off without usb being connected to PC and com port?
my ir command are working with USB connected with serial communication but Arduino goes offline so and command can't be send from com ports.

What type of IR sender are you using ?

I am using Haobase 6 pairs Infrared Diode LED IR Emission and Receiver

https://www.amazon.com/gp/product/B01EMXC5XA/ref=as_li_ss_tl?ie=UTF8&psc=1&linkCode=sl1&tag=farrellf-20&linkId=8bce64589643ee5f81a74a6245c00e94

when Arduino is ideal arduino’s yellow led power light goes off and commands does not work unless I remove USB power and put it back to restart.

What is supplying the USB power ?
Please post the code that you are using. Did you write it ?

Now Arduino is connected to windows laptop, in future it will be connected to windows PC only.

This is my first attempt in IOT

Please find below Code (i copied this code from http://farrellf.com/arduino/infrared.ino):

#include <IRremote.h>

IRrecv receiver(2); // receiver is connected to pin2
IRsend sender;
decode_results results;

long repetitions;
long count;
unsigned int durations[100];
void (*reset)(void) = 0;

void setup() {
Serial.begin(9600);
receiver.enableIRIn(); // start receiving signals
}

void loop() {

// check for text from the PC
// the PC sends a string containing “r,n,a,b,c,d,e,…” where r is how many times to repeat the command,
// n is the number of durations, and a/b/c/d/e/… are the durations.
// the durations are how long each mark and space period of an infrared command should last, in microseconds.
if(Serial.available()) {

// parse the text
repetitions = Serial.parseInt();
count = Serial.parseInt();
for(int i = 0; i < count; i++)
durations = Serial.parseInt();

  • // send the command using 40kHz PWM*

  • for(int i = 0; i < repetitions; i++) {*

  • sender.sendRaw(durations, count, 40);*

  • delay(50);*

  • }*

  • // for a bit of fault tolerance, reset the arduino after receiving any command*

  • reset();*

  • }*

  • // check if a decoded infrared signal is available*

  • if(receiver.decode(&results)) {*

  • Serial.println(results.value, HEX);*

  • Serial.print(results.rawlen - 1);*

  • for(int i = 1; i < results.rawlen; i++) {*
    unsigned int number = results.rawbuf * USECPERTICK;
    * Serial.print(",");*
    * Serial.print(number);*
    * }*
    * Serial.println("");*
    * receiver.resume();*
    * }*

}

Please find below Code

It seems that you did not heed the advice to use code tags given in the sticky posts at the top of the forum page, hence your code as posted has italics in it.

Edit the post and add code tags.

Now Arduino is connected to windows laptop, in future it will be connected to windows PC only.

Does the laptop go into any kind of power saving mode after a period of inactivity ?

No laptop does not sleep at all.

Laptop does not sleep but may shut down the power on the usb's for power saving if it thinks its not being used.

Daz

Daz1712:
Laptop does not sleep but may shut down the power on the usb's for power saving if it thinks its not being used.

Daz

That sounds quite likely

Daz1712:
Laptop does not sleep but may shut down the power on the usb's for power saving if it thinks its not being used.

Daz

That problem caught me by surprise a year ago. When the laptop screen saver blanked the screen, it also shut off the USB power.

Paul

Now they shut down the usb even if you are typing away but not using the usb port, all in the name of power saving.
You must have traffic through the port to keep it active.
Maybe have the Arduino spitting data to the laptop even if its not displaying?

Daz