![]() |
Forum Index : Microcontroller and PC projects : Server shutdown timer 1A
Author | Message | ||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9586 |
Hi folks. ![]() Most UPS units for computer backup power, have either a serial port or a USB port, for connection to the host, and this link can be used to safely shutdown the computer. The problem I have had recently, is that all the software is for Windows or Mac, and nothing for Linux. Even the Windows software tends to be overly complex and unstable on the cheaper end of the UPS market. So, I decided to come up with a Micromite powered alternative: TOP LAYER: ![]() BOTTOM LAYER: ![]() This board is already produced, so there is no design-by-committee issues with this one!!!!! ![]() ![]() The main advantages of this idea are: - It does not need software to act as an intermediary - It does not care one jot about computer type - It will work with Windoze, Mac, Linux, BeOS, Unix... anything. - Adjustable timer time between 1 and 15 minutes - Can automatically re-boot the computer(some BIOS's don't let you do that) The concept is pretty simple. The unit trickle-charges the 9v rechargeable NiCd battery, which takes over powering the circuit(via a diode gate) if the juice fails. Please, no comments about the most basic of basic charging methods - it works, and works well. Although constant trickle-charging like this will technical kill the battery quicker then a delta-V monitored arrangement, it will take several years. It is important to note at this point, that I am using NiCd rechargeable battery, NOT a NiMH or Li-ION type - they do need a more advanced charging system. The Micromite monitors the incoming 12v power by way of a potential divider formed around a 10k and 3k3 resistor. The unit is powered normally by an external 12v plug-pack plugged into the NON-UPS side of the power. When the power fails, so will this 12v supply, which the Micromite will detect. This starts the timer, and once the set time has elapsed, the unit will close the relay contacts and shutdown the server. The relay contacts are N.O, and are connected in parallel with the system's main power button, simulating a power button press when the timer runs out. The timer has to be set in proportion to the size and backup capability of the UPS being used, such that the timer will time-out BEFORE the UPS goes flat. In my case, I am using several NASLite-2 x64 servers which run from 64MB(yes - MB, not GB) USB flash drives, and although Linux based, they are NOT GUI based systems, rather HTTP-based, so you cannot install extra software as such. So I needed a way to be able to shut these down in the event of a power cut, but the UPS's I used only had Windoze software to do that. ![]() If anyone is interested in a PCB, flick me a PM. Smoke makes things work. When the smoke gets out, it stops! |
||||
jman![]() Guru ![]() Joined: 12/06/2011 Location: New ZealandPosts: 711 |
Hi G That's a great use for a UMite well done BTW have you seen FreeNas Regards Jman |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9586 |
Hey, jman. Yes, checked out FreeNAS, but I found it way too complicated. ZFS filesystem was attractive, even though it needs huge amounts of RAM to be happy, but although I setup a FreeNAS server, I did not like a couple of aspects of it: 1) Too complicated to get simple access to it, with permissions for this and that etc 2) Too memory hungry with ZFS(although you could just use ext3 or ext4 and less RAM) 3) All drives seemed to be forced into one RAID arrangement. #3 is the killer for me more then anything else. Forced RAID array(perhaps one of the RAID's with redundancy) is great for no down-time, but means you have to have shares in the HDD market. ![]() Some will no doubt not be in favour of that idea - no user accounts, and no security. Anyone who can find the server on the network, can read and write to it. You CAN make volumes read-only in the admin utility, which is how I have one of them setup - you can read from it, but not alter or write to it. ...but I digress - I have gone off on a NASLite rant... ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
viscomjim Guru ![]() Joined: 08/01/2014 Location: United StatesPosts: 925 |
Grogster, you are on a manufacturing roll. I just got back my first micromite pcb from Itead. This is fun.... now I get it. |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9586 |
A consequence of giving up drinking. Six weeks now and no booze. The practical upshot of which, is that I fill in the time designing PCB's instead of getting drunk. ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
viscomjim Guru ![]() Joined: 08/01/2014 Location: United StatesPosts: 925 |
OT but congrats on the drinking thing. A very good "consequence" indeed. I hope you stay inspired as your posts have been very beneficial to us all. Keep designing and more importantly, keep posting about them. I love this stuff. uMite has been a game changer for me since early beta days... Could you post a schematic and code for the unit above... looks interesting. |
||||
bigmik![]() Guru ![]() Joined: 20/06/2011 Location: AustraliaPosts: 2949 |
Grogs, Are you going to change your name to PCBSTER now? ![]() Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
hitsware Guru ![]() Joined: 23/11/2012 Location: United StatesPosts: 535 |
> Are you going to change your name to PCBSTER now? ![]() ![]() ![]() ![]() |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6266 |
My new UPS is a 'no name' with USB interface. I tried to get one with RS232 but no joy. Many years ago (everything seems to have happened many years ago), I worked in the power industry and we have some wonderful old instruments. One I liked was a disturbance recorder. Whenever it was triggered, it would spit out a couple of metres of paper with a chart of the voltages and currents for a few seconds before the event and a few seconds after. Last week I was sitting at the 'puta when there was a power 'disturbance'. I missed the pretty charts so micromite to the rescue. The idea is to have one micromite continually reading the voltage and when triggered, spit the 5000 readings out to be analyzed. A MX150 micromite can take 30 readings per 50Hz cycle and a maximum of 5000 readings. That gives around 3 seconds. If you trigger it 2 seconds after the 'event', you will end up with 1 second of pre-event and 2 seconds of post-event. A MX170 can read a bit faster and store more samples. I will end up triggering from a second micromite similar to Grogster's setup. If you aren't interested in looking at the AC waveform, use a rectifier and a small filter capacitor then slow the reading rate down. For the AC input I found an old plug-pack with AC out. The chart is a portion of a test drawn in Excel. ![]() ![]() DIM readings(5000)
SETPIN 5, INTL, snap SETPIN 4, AIN n=1 DO readings(n)=PIN(4) n = (n+1) MOD 5000 LOOP END SUB snap FOR k = 1 TO 5000 PRINT readings((k+n) MOD 5000) NEXT k END SUB There is no time for the micromite to do any calculations during capture but I am impressed with the quality of the waveform in Excel. Now I have to wait for a real life 'disturbance' to capture. Jim VK7JH MMedit |
||||
paceman Guru ![]() Joined: 07/10/2011 Location: AustraliaPosts: 1329 |
That's pretty interesting Jim - how are you going to define a "disturbance" and trigger it? We used a disturbance meter occasionally too - years ago ![]() Greg |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9586 |
Heh, heh - no, I like that nickname. ![]() I actually was awarded that name back in High School - yes, been a drinker for a LONG time..... I just woke up one morning and thought to myself: "Why am I doing this? I don't even like it, or get any enjoyment out of it anymore." It's a kind of epiphany thing - you realise you have been on the wrong track for years - time to turn around, and head back the other way. We'll see how long I can stay on the wagon, but once you are truthful to yourself, stopping is the easy bit. Making sure you don't "Fall off the wagon" by way of temptation - that is the hard part. Smoke makes things work. When the smoke gets out, it stops! |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9586 |
As an update to this thread, here is the current working code for this unit: 'Server Shutdown Timer 2 cpu 5 'Run CPU as one-cylinder rather then a V8. setpin 6,din:setpin 7,din:setpin 9,din:setpin 10,din:setpin 24,din setpin 2,dout:setpin 3,dout:setpin 15,dout:setpin 16,din:setpin 26,dout Pause 1500 T=0:E=1:B1=0:B2=0:B3=0:B4=0 if pin(6)=0 then B1=1:E=0 if pin(7)=0 then B2=2:E=0 if pin(9)=0 then B3=4:E=0 if pin(10)=0 then B4=8:E=0 if E=1 then 'No valid time set, so begin red blinking loop forever do do pin(2)=0:pin(3)=1:pin(26)=1pause 125 pin(3)=0:pin(26)=0:pause 125:X=X+1 if X=4 then exit do loop pause 3000:X=0 loop endif T=(B1+B2+B3+B4)*60 'Build time delay X=0 do 'Valid time period set, so blink green pin(2)=1:pin(3)=0:pause 150 pin(2)=0:pause 150:X=X+1 if X=4 then pause 1500:exit do loop start: do pin(2)=1:pin(3)=0:X=0 'Green LED for standby if pin(24)=0 then 'Mains power failure detected do 'Begin time delay pin(2)=1:pin(3)=0:pause 125 pin(2)=0:pin(3)=1:pause 125:pin(3)=0 if pin(24)=1 then goto start 'Mains power back again pin(26)=1:pause 50:pin(26)=0 'Pip piezo pause 700:X=X+1 if X=T then exit do 'Time's up! loop pin(2)=0:pin(3)=1:pin(26)=1 'LED red, piezo on pin(15)=1:pause 1250:pin(15)=0:pin(26)=0 'Power down server if pin(16)=0 then 'Auto-reboot blobs selected do if pin(24)=1 then pause 5000 'Wait for power to come back on and be stable if pin(24)=1 then pin(2)=0:pin(3)=1 pin(15)=1:pause 1250:pin(15)=0 'Power up server pin(3)=0:goto start endif pin(2)=0:pin(3)=1:pause 50 pin(2)=0:pin(3)=0:pause 950 loop endif do pin(2)=0:pin(3)=1:pause 100 pin(2)=0:pin(3)=0:pause 1000 loop endif loop The unit is working beautifully, and I have it setup to reboot the server when the power comes back on and stays on for at least 5s. This delay is to make sure the power is stable before the attempt is made to reboot the server. Sometimes, due to start-up load on the system after a power cut, the power can be a little "Dirty" until all the load has settled on the network. If the Auto-reboot blobs are not shorted, then once shut-down, the unit just blips the LED at you red, to indicate that it has shut the system down, and you must then press RESET and power up the server yourself manually. As mentioned, this PCB and code will work with ANY server that allows pushing of the power button to shut it down safely, from cheap single-drive $50 things, to full-size corporate servers. PROVIDED you can shut down the server by pressing the power button and then releasing it - most servers do it this way, but I am guessing that not all on the planet will. I have had this code running for about two months now, and have simulated several short power cuts, and full power cuts to test operation. Everything works as expected. Smoke makes things work. When the smoke gets out, it stops! |
||||
viscomjim Guru ![]() Joined: 08/01/2014 Location: United StatesPosts: 925 |
Hi Grogster, VERY nice unit!!! Could you post your schematic for this one? Board looks nice too!!! |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9586 |
Flick me a PM if you are interested, Jim. I can email you the schematic if you like. I also have spare PCB's if you would like one to build your own unit. US$5 + postage. Smoke makes things work. When the smoke gets out, it stops! |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |