Main > Raspberry Pi & Dev Board

Arduino code

(1/6) > >>

lilshawn:
I'm having issue with a machine's computer, whereby it is supposed to power on at startup, but despite the bios set to "on AC restore" being on, it sometimes does not. otherwise, the computer works just fine.

i would like to create some Arduino code that basically monitors the negative side power LED pin header for ground (IE a turned on power led) every say..10 seconds... and if it sees it's not "on"... then to turn on the computer.

i did create a program to just wait and then "power on" the computer by "pressing the button" which does work...except when the computer decides to actually work and power on... in which case...it helpfully turns off the computer at this time.

so, semantics aside, i would like to implement monitoring/check of the computer's power LED control line so if the computer IS on, it doesnt try and turn it off.

i'm old and tired and don't have much head to wrap around this...any help would be wonderful. i've kinda thrown some stuff together here... it's out of order and obviously would never work...i just sort of started typing ignore my comments, i'm a self-depreciating programmer... would eventually move things around to where they belong. i need a then do this somewhere... at least let me know if i'm on the right track anyway. I could do this in basic. please,thanks!

--- Code: ---void setup() {
   int start = 2;
  int power = 3;
  int powerState = 0;
  int lastPowerState = 0;
  pinMode(start, INPUT);
  pinMode(power, INPUT);
 


void loop() {}
//CHECK THE POWER LED LINE TO SEE IF ITS ON OR NOT


//STARTING THE ---smurfette---
  pinMode (start, OUTPUT);
  delay(150);
  pinMode(start, INPUT);
  delay(150);
  //END STARTING THE ---smurfette---
   
 
}

powerState = digitalRead (power);

// compare the powerState to its previous state
  if (powerState != lastPowerState) {
    if (powerState == LOW) {
      // if the current state is LOW then the computer went on:
         
    } else {
     
    delay(50);
  }
  // save the current state as the last state, for next time through the loop do i need to actually do this or nah probably only need a one shot anyway so no need to loop idiot but if so then here we go
  lastPowerState = PowerState;
--- End code ---


baritonomarchetto:
So, will the Arduino always be powered by an external PSU H24? If yes, isn't this going to be a waste of energy? Wouldn't it be more convenient to wire a button to the power on the motherboard pinheader and press it in those rare cases the PC doesn't turn on by itself?

One approach for this could be monitoring for 5V at any unused PC power connector. Arduino should be powered by an external 5V source and in turn connected to the same switch of the PC. This way arduino is notnpowered H24 and is not going to continuously switch the PC on. An ATtiny85 micro should be more than enought for the task.
AnalogReadSerial example could be a good starting point

lilshawn:
yes it powered by the offending computer's USB port with the port set to be powered by +5SB, so it's always on if the power supply is plugged in and has AC voltage.

this computer's state will be 99% on. I need this for the random part of 1% that it decides not to come on.

this board is also an intel board so when it gets power it does that stupid little thing where it powers on for 3 seconds then turns off when it gets power so the old "capacitor on the power button header" thing doesn't work.

normally i wouldn't mess around with this, but the computer is locked in a cabinet...and if it powers off due to power interruption, I NEED it to come back on all the time. I can't be driving 6 hours to go press a power button.

nitrogen_widget:
did you look for a bios upgrade?
might be a known problem with the board that is fixable.

lilshawn:

--- Quote from: nitrogen_widget on October 23, 2022, 06:55:45 pm ---did you look for a bios upgrade?
might be a known problem with the board that is fixable.

--- End quote ---

yeah, i tried messaging the maker but did not get a response. they make embedded boards for crap and literally provide no support because their contract states they leave it to the OEM they made it for to provide "support" IE nothing... since the OEM didn't make the BIOS they have nothing.

I also have 12 other computers that operate correctly and they have the same firmware version. I even pulled a bios chip from one of the good computers, dumped the contents...and then wrote it to a brand new chip...and it still does not behave properly sometimes.

it's weird, because this is a common issue with this board (have had 3 machines do this now)... and company did not do anything about it except swap the boards for a different one. now those replacement boards are NLA (ebay puts them between 600 and 1200 ea USED) and the whole hardware kit has hit hard EOL and the alternative is stupid and involves about 3 grand and all new everything except the important user bits.

not to mention that means shoehorning a 16:9 image on a 19" 4:3 screen.  :banghead: yes, we like using a magnifying glass to view images on 5" of screen.

Navigation

[0] Message Index

[#] Next page

Go to full version