Saturday, June 8, 2013

On Western Digital hard drives, PUIS and Rocket Raid controllers

Disclaimer:  This procedure worked for me.  Use at your own risk.  It uses software not written by me and downloaded randomly off the internet.  If you break something, it isn't my fault.

So a while back I bought 4x1T WD green hard drives (WD10EACS) and a rocket raid 1740 to use with them.  I eventually ended up using them as JBOD (turns out it didnt support hardware raid 5) for a few years with no problems.  This was until I upgraded my server with a motherboard that supported enough sata drives and no longer needed the raid controller.



Turns out, if you ever set staggered spin-up on these drives as I did, it sets some internal flag on the drive to use a thing called PUIS or Power Up In Standby.  This means the drives don't actually start spinning until they receive a request for some data.  Problem is, these particular drives don't support it (or something) and some sort of hack is in place in the rocket raid controller to get around this.  Long story short, none of my drives now work on anything but the RR controller.



This problems is vaguely documented around the web, this
http://forum.hddguru.com/how-reset-puis-drives-after-highpoint-raid-t20208.html
being the most prominent.  It details using various tools and things to get them working again.  After about a day of trial and error, I finally fixed my drives.  To save anyone else the days worth of effort, I've documented my solution here:

Firstly you need to go and find a tool called HDAT2 from http://www.hdat2.com/  download it and create a boot disk for it.
Then a tool called MHDD is needed but you need to inject the bootable ISO with some script files from the above hddguru address.  Problem is, this is quite difficult and requires a floppy drive, or a virtual floppy drive which turns out is quite difficult to use on a 64 bit machine.  Virtualbox and 32bit windows XP to the rescue. After a fair bit of futzing around I finally ended up with a final ISO file that can be burned and booted - the hddguru post doesn't say exactly where one of the bin files needs to go so I had to guess around a bit before getting it right.  Get the bootable ISO from here: https://dl.dropboxusercontent.com/u/3869172/bootable3.iso
If you want to make your own, then just remember that PUIS goies in the scripts dir and off.bin goes into the dir above that.

So boot up with HDAT2  (it will likely take a while to get past the bios and detecting your non spun up hard drives) and you should end up with a command prompt.  Type
HDAT /w
the /w is the important part, this will spin up the drives for you and start the hdat application.  We don't actually need HDAT for anything other than spinning up the drives.  All going well HDAT should now see your drives:



Swap your bootable CD with one MHDD one you downloaded (bootable3.iso).  Reset your computer.  This is important. If you shut down or power off your computer the hdd's will stop spinning and you'll have to start again.  You need to reset.  It should actually be quite quick to get past the BIOS now because the drives will be instantly detected.  Wait for MHDD to start and you should end up with something like this:



Now it is just a matter of selecting which drive is causing you problems (in my case both, well 3 actually but one isn't displaying for some reason - perhaps I was being a bit optimistic trying to do all 3 at once).  Once you select the drive by typing its number and pressing enter, type
.puis
After you accept the disclaimer that pops up, it should all be working again.  DRIVES FIXED!

Now a bonus image of the rig I used to get this all working:



Bonus searching keywords stolen from Hddguru:
Drives not identified in BIOS
WD drives don't spin up after removal from Highpoint RAID 23xx 2300 2310
WD PUIS problem
WD PM2 problem
Reset WD PUIS
How to reset WD PUIS
How to fix staggered spin up problem with drives after highpoint Raid
Invisible drives after highpoint raid
Highpoint RAID makes drives unusable

Friday, May 17, 2013

The Centurion

Have you ever played the brutal drinking game called the Centurion?  It goes like this - have one shot of beer every minute for 100 minutes.  It may not sound like much, but if you think about it, a 30ml shot 100 times is 3 litres of beer in a little under two hours.

Anyway, I've played this a few times and the biggest problem is keeping track of time and who has drank what.  Usually you need a timekeeper who isn't playing to ensure that all drinks are taken and that we drink at the appropriate time.  Well, for an upcoming bucks weekend (mine), I decided to remedy this.

I build it into an old tool case I had lying around.  There are 8 double seven segment displays to keep track of players scores, all driven by 595 chips attached to transistor arrays.  I decided not to use a 7-seg driver chip because it would have been more of a pain to solder.  The 595 and ULN2803 transistor array can pretty much be mounted side-by-side.  Since I didn't etch my own board, this means less point-to-point soldering.

The whole project is driven by an Atmega8 chip and coded via my Linux server.  The main board uses a 195 to read the state of all of the push buttons.  I count overflow interrupts to know when 1 second is up, and have a pause button hidden under a missile switch - you wouldn't want to accidentally pause this game.  I also built in a programmer pin-header to program the atmega chip in situ.

A large double 7segment display is used for the main timer - it actually required 7.something volts to run properly, so that was a pain.  The original plan was to have another of these on the right to count drinks elapsed, but I ran out of time.

I picked up some automotive LED strips as well as a home alarm screamer to notify the players when it's time to drink.  A potentiometer regulates the volume of the screamer, as well as some gaffer tape - it was particularly loud to begin with.  Fun fact - screamers sound weird when you change the amount of current going into them.

The whole deal is powered by a 12v SLA rechargeable battery which sits inside the case.

Misc photos of the whole process with bonus video at the end:

The main-board

Back of the main-board

The timer display

Back of the timer display

One of the scoreboards under construction

One of the scoreboards under construction

Completed scoreboard

Back of a completed scoreboard

Components ready to be mounted

Underside of the base.

Inside of the case - almost complete!

I added some dry-erase stickers so we don't lose track of who is who.

Closed for travel.

Thursday, April 21, 2011

7 Segment Displays

As a part of my project to build a breathalyzer using the MQ-3, I needed a nice way of displaying how much drink you've had. I had some 7-segment displays in my box of stuff that I had bought previously. They are from futurlec. Datasheets can be found by googling 7DR8021BS.


2-digit 7-segment display (I accidentally blew the middle decimal point, which is why you cant see it - its blacked out with some texta).

These 7-segs use common outputs for each segment, and a separate input for each digit:


The segments are labelled as in the next image - I believe this is standard.


Since the outputs are common I had to switch between digit #0 and digit #1 really quickly while at the same time connecting the outputs to ground to make whatever digit I want display. I could have used a 4511 driver chip for this, but I still need some transistors to connect the output to ground. Also the 4511 only drives 7 segments (so no decimal point) so instead I decided to use a 595 shift register. Same amount of pins on my Arduino to drive it, but more outputs!

My initial design used a bunch of discrete transistors, but this got messy fast. Even though it worked, I wasn't satisfied. It also meant a HEAP of extra soldering if/when I put this on perfboard:


Original design - note the upside-down arduino to control it.


Too many transistors!


As I refined my design, I discovered that you can get a transistor array on an IC - the ULN2803a. This IC has a common ground, so it switches directly to ground - which is ideal for these displays.

When coding for a setup such as this, you just need to switch stuff super fast. The first thing I did was work out what number (in binary) represented each digit I wanted to display. Then you just turn off everything, shift the digit into the shift-register (to drive the transistors) and turn on one of your inputs. Then repeat. eg:

for(;;)
{
turn off both of your inputs (digit 0 and 1)
shift some data into the 595 chip to set-up the output transistors for digit 0
turn on input 0
sleep for a milli or something (not strictly necessary)

turn off both of your inputs (digit 0 and 1)
shift some data into the 595 chip to set-up the output transistors for digit 1
turn on input 1
sleep for a milli or something (not strictly necessary)
}

Theres obviously a bit more code around it than this, but you get the idea.

Wednesday, April 20, 2011

Arduino

Today I'm going to harp on about programmable micro controllers. Some of my older posts indicated that I was/am working on a computer-controlled pinball machine. That project is still going (albeit hasn't been worked on for a while) but while prototyping things and learning how TTL chips worked, I discovered the awesomeness of microcontrollers. I initially bought myself a Basic Stamp from parallax, which was good, although I had to program it using an RS232(serial) port, which I had a hard time finding. I had to resort to using an old laptop for this.


Basic Stamp

I learned some of Parallax's basic language and set about working out how to use 595 and 4094 and 165 and other chips that I would need. The 595 and 4094's are shift registers see one of my older posts for 4094, and wait for an upcoming post about the 595.

So things were good for a while and then on one day without warning, the magic smoke escaped from my basic stamp. God knows why, but it ended up being a good thing(tm). After some research I decided that an Arduino would be the way to go.


My Arduino (may or may not be a knock off).

I believe most Arduinos are made in italy (and say so) but mine says made in china. It could be a knock off - but who knows. One of the perils of being cheap and buying on ebay, i suppose. It's open source hardware so nothing dodgy took place, although I would have liked to support the nice people over at Arduino or wherever.

Anyway so an Arduino provides you with a bunch of IO pins that you can read/write from/to as well as some analog pins (which come in very handy when using an MQ-3 alcohol gas detector!). It's all programmed in C, using the wiring/processing library which abstracts the jesus out of port IO. I know this because I have recently successfully programmed an atMega8 chip (more about this later).

The moral here is, if you want to do anything with electronics, go out and buy yourself an Arduino. It's well worth it. Also get a breadboard and hookup wire.

Thursday, April 14, 2011

The Bluff Trail

Went hiking last weekend. It was fun. Starting near Howqua (past Mansfield) at 8 mile flat, we did the bluff trail circuit (details here).
This starts off as a moderate climb over some mountain along 8 mile spur and then down again.


8 Mile Spur views

Then the fun came when we had to climb The Bluff itself which is a huge mountain (1726m). Well worth it though as the views were fantastic - especially Mt Eadley Stoney to the east:



Mt Eadley Stoney

Climbing the bluff was quite difficult, there was some pretty serious rocks to climb up to get to the summit. Difficult with an 18kg pack on your back.

Slept the first night at the Bluff Hut which is a few k's from the summit of The Bluff. Handily, there were already some people there with a fire going for us. It then was massively windy and rainy ALL night - had to get a good nights sleep.


The Bluff Hut - early morning

The next day we travelled along the 16 mile jeep track (not for 16 miles) which was mostly down hill to the Howqua River. We missed the turnoff to the west to go along the river and ended up about a half k out of our way at Pikes Flat (no big deal, I always wanted to see Pikes Flat anyway).


Pikes Flat

Walked along the river to Ritchies hut for lunch (no pre-made fire this time).


Ritchies Hut

Then along the 'high track' back to 8 mile flat (the start/finish point of this circuit). There was the option of taking the 'low track' but there were some pretty serious river crossings (like up to my waist serious) that would have sucked.


High Track

Monday, April 4, 2011

Im blogging again

So after a reasonable hiatus in which I have done many, many things (including building and moving into a new house - yay) I'm going to start writing about stuff again.

In keeping with the amateur electronics-ey theme of this, my first post back is going to be all about the venerable MQ-3 Alcohol Gas Detector that I picked up a while back after reading some articles about it on hackaday and various other sites.

I picked a couple up from Little Bird Electronics (whom I highly recommend) as well as handy-dandy carrier boards:
http://littlebirdelectronics.com/products/alcohol-gas-sensor-mq3 and
http://www.pololu.com/catalog/product/1479 (i cant seem to find this on little-bird anymore though.)

It's pretty easy to wire up your own circuit which mimics the carrier board, but the carrier board makes life even easier. Ignore what the data-sheet says and use a 1k resistor (I think the datasheet says to use 200 or something, but I could be horribly, horribly wrong on that).

Solder your MQ-3 onto the carrier board - it turns out that there is no polarity so you can solder it on any way you like, and it'll just work. Add the resistor and a pin header to make life easy:



I bent my pin-header out a bit to make blowing in it easier - especially when cables are connected. Also there are 2 sets of spots that you can connect your resistor to. It's a bit hard to see, but if you look at the traces, it makes exactly 0 difference which set you connect it to.

Now the other thing I hear about the MQ-3 is that it needs to be 'burned' in. It has a little heater in it that runs off +5v. After turning the MQ-3, it needs to heat up. In normal use this should take around a minute to warm up and the reading to stabilise, but I read around the traps that you need to plug it in and turn it on for 24-48 hours to make it work more betterer (this is, I'm assured, a technical term).

Coming next: Ardunios, shift registers and 7 segment displays!

Thursday, May 21, 2009

That damn flippity flop music

Otherwise known as flip-flops - these are handy structures that store 1 bit of information - a 1 or a 0. Imagine 8 of them put together and BAM - 1 byte of memory, or imagine 8589934592 and again, BAM, a gig of memory!. So I dont really need much memory for my application as it is all going to be controlled by a laptop which has its own memory anyways. What I do need, though, is a way of remembering if a button has been pressed or not in hardware. This is because (and i cant remember if i talked about this earlier) i cant guarantee that ill be checking the state of a switch while it is actually pressed, so the next best thing is to work out if it was pressed.

Now theres a heap of different flip flops that one can use: SR (set-reset), JK (not sure what that stands for) and more. I have elected to go with an SR type flip flop, which I made myself out of a couple of NAND gates. I reccomend spending some time on this site: http://www.falstad.com/circuit/e-index.html learning how stuff works. If you check out the SR flipflop (unclocked) on that site, youll see a part of the circuit im creating.

So i couldnt find any SR flipflops in a handy dandy IC package so i decided to make my own out of the heap of nand gates i had lying around. I got a little lazy and decided to do it all on a breadboard.Breadboarded NANDS to make flip-flops

Those wires hanging off are going to be terminated with a standard 40 pin IDE cable, and connected on to the actual input board (more about which later).