Log in

View Full Version : PIC Programming, USB LCD and other questions...please make some suggestions!



DaveW
01-16-2006, 02:22 PM
OK, this is going to be very complicated-just bear with me! I'm a half good PIC microprocessor programmer, and i've got some ideas that i want to impliment with the aid of a PIC programmer. I know that when the PC is off, the only power is a 5V line going into the motherboard which allows for the push to make button to work. Brilliantly, the PIC microprocessor can run on a 5V line, so i can have the PICs powered up while the PC is off. Which is good, because i want certain functions to be avaliable when the PSU isn't active. Alright, time to dive right in...

PIC 1:
Pic 1 is going to control a door in the case, which opens up to reveal the fan speed controllers. All the case fans are going to be hooked into a single controller, with the CPU fan hooked up to the motherboard as usual. The case fans will be controlled by the buttons behind the door, but wll start up at medium speed. The Fans are going to be connected to the PIC, which is going to produce a voltage output with some sort of Analogue to Digital relay circuit, that is the fan speed is controlled by the PIC. The fans are going to have 10 speeds, and an LED matrix will display which speed the fans are currently going at. The Door will open on startup, and after shutdown, i want the door to close. I'm doubting the 5V will be enough to power the motor after shutdown, but anything's possible i guess. There's also going to be an emergency in port, in case the temp gets too high, turning all the case fans onto full blast. Pin count here is 5 pins for the LED matrix, 1 pin for the emergency in, probably 4 pins to control the door, and another pin which is high when the computer is powered up, and low when the computer is powered down. So i'll need 11 GPIO pins, which is ok-there are 13 GPIO pins on the 16 bit PIC.

PIC 2: Pic 2 is going to drive 2 temperature sensors. It's going to take a temperature signal from the CPU and from the case, and it's going to display in on two analogue counters on the front of the case. This means that on power down, the analogue counters get reset-so i want to have the analogue counters reset either on startup, or when the CPU powers down. As far as i know, the only way to do this is to reset it using the 5V line, when the PIC detects that there isn't any Power going to the motherboard, i.e. the PSU is powered down. This will require another 16bit PIC i think, as well as having an emergency out line to send to PIC1 should the temperature of the CPU or the case rise to an unacceptable level. If it continues to rise too far, then the PIC will send a power-down signal to the motherboard, which should only cut in when there's a major temp increase-this wouldn't really be necessary because the mobo probably shuts down at a certain temp, but all the same, what's important is that this PIC and the other both have functions that need to work from the 5V line, and i'm not particularly looking forward to mucking about with it. Although the worst that could happen, realistically, is that that i can't get the PSU to boot up. When that happens i've spend all my money setting this up for it not to work.

Theory 1:
I want to also include a LCD display, probably a 20 by 4 character display, and run it from the USB port pins on the motherboard, so that i can send data to display down the USB port. I don't know if this is possible or not. I'm hoping it is, because if it isn't, then it puts a major bummer on my case mod.

What i need are ideas. Has anyone ever used PICs for this sort of thing? Any ideas about how to run my display? I would really like to know if there's a signal the motherboard sends out when shutting down, so i can perhaps get a 'dont power down the PSU till you get this line high' sort of line, which will give me time to close the fan controller doors and reset the analogue counters.

I know that this is as clear as muck, but what i need is someone to tell me if there's any fundamental flaws in my ideas, and if anyone knows anything about programming an LCD character display through the internal USB, i'd appreciate it greatly. I'd also appreciate any suggestions on how to get all this together-when i've got some of this sorted out i'll try and run up a sort of circuit diagram. I've got a book-PIC microprocessing, Bates-so i'm all set up for how to use the PIC, as well as having done a course in microelectronics. I've never used the PIC outside of the circuit tester though, so this is my first foray into actually using the PIC for something useful. I don't want to waste my time and money if i'm going to screw it all up, so i want to know from a like-minded group what they think of this.

-Dave

crazybillybob
01-16-2006, 03:17 PM
Dave,

I'm just learning pics (Still picking out a cheapy burner and reading up on it's assembly code If you’ve got any good places to look let me know!).
As For opening doors and ports and what not. Look into Servo's (the type used on R/C planes, cars, and boats) they can run on 5V and there pulsed so the current draw should be low. There are 20x4 line LCDs that work VIA usb (matrix orbital, crystal fontz, just to name a couple). Now the one thing I can see as an issue is the fans. Those fans are going to draw way to much current for the standby line, and will toast the pic if you try and drive them with it as most pics have a total output (when driving all ports @ once) of 100mA ea. Most fans are looking to eat 500ma or more ea. Your going to need a driving circuit for them maybe opto couple the PWM signal to FET amplifier or you could use a Darlington pair transistor amp to deliver the current and voltage needed.

for temps there are several IC that can do most of the work for you (that way you only need a few IO lines and not a whole 16bit PIC) Like the DS1620 uses I2c communications to send temps. If you don't want to use I2c then 2 Pics will work as well.


It looks like a good Idea, and allot of work but Fun and a neat effect in the end.

Crazybillybob

DaveW
01-16-2006, 03:25 PM
Thanks for that, i hadn't thought of that. That is, the servo motors for the door. The fans are going to run off a sort of relay circuit, at least that was my initial plan-they aren't going to be a part of the delicate PIC circuit. Somehow i need to find a way to control the speed of the fans in the fan circuit through some clever device which i havn't thought up of yet. I was just going to have the fans power up on the PSU boot, but have some sort of electronic variable resistor in place that the PIC controls. Sound like a plan, or an idiot talking? Thanks for the hint about the Matrix orbital, i'd seen them before but they look expensive. I was looking for a more component LCD module and driver than a finished drive plate product, and i don't want all the buttony things and remote crap that come with the matrix. I'll have a look though and see if i can spot anything that suits.

-Dave

DaveW
01-16-2006, 03:28 PM
Whoop! Just found the perfect display! Thanks CBB!

But damn...it's expensive at like £60....

Oh, and there's a website that cuts the crap and gets to the basics of PIC microprocessing, although it's actually a website about that Real Robots magasine robot. My brother was building it, and apparetly there's a PIC burner in the handset, that you can use to burn some PICs. I'm not expecting that to be great, but i'm expecting it to be cheap if you know someone who, like Adam, has got all the magasines and not bothered to build it, or manages to lose a vital part.

I love the fact that in this case the vital part is in fact half the components of the controller.

I'm looking at the Maplin burner kit, at £29 you can just solder it yourself, and that's you. Although i don't know what software this comes with, try and get a burner with MPASM IDE i think it's called, or something like that-it lets you program chips in C and assembler. Although at Uni they had disabled the C part of the program. Probably just as well considered the pass rate or the Assembler course-i think 80% of the class were trying to cheat and write in C.

Anyway, thanks for the pointers-those Servos look like they are my ticket to doorville.

crazybillybob
01-16-2006, 03:46 PM
You can find the Bare displays for $5us if you look (this on is 2x20) www.bgmicro.com (http://www.bgmicro.com/prodinfo.asp?sid=05234027777777781521601664&prodid=LCD1022&page=1&cri=LCD&stype=2)
here's a 20x4 //www.mini-itx.com (http://www.mini-itx.com/store/?c=25) then
or
www.watercoolingshop.com (http://www.watercoolingshop.com/catalog/product_info.php?products_id=392) (last 2 were in Brit Pounds)
the Serial interface boards run about $30us but they all are over your Rs232 port www.matrixorbital.com (http://www.matrixorbital.com/index.php?cName=lcd-interface-module&osCsid=bcee33da992e01b0a5d78731c7db82e8) or www.kronosrobotics.com (http://www.kronosrobotics.com/xcart/customer/product.php?productid=16380&cat=291&page=1) or
www.seetron.com (http://www.seetron.com/slcds.htm).

Then you can build your own (based on a PIC uC)
www.hackaday.com (http://www.hackaday.com/entry/1234000780071754/)


Hope that gives you some lower cost options.

Crazybillybob

Let me know if I can help with anything.

DaveW
01-16-2006, 04:35 PM
I'm looking at that PCB for 20 char. Display...looks like it might be worth a shot, although i'd need to get someone to actually burn the board for me. Problem is that i don't think my Mobo has a pin output for serial, although im sure it does for USB, so i could keep everything internal...i'll keep looking. If it comes down to it, it'll be worth paying extra to get it to look just right, you know?

Thanks for the pointers, hope to be on here soon with a kick-ass mod journal...

OvRiDe
01-17-2006, 05:19 AM
I'm not sure if you have seen this thread (http://www.thebestcasescenario.com/forum/showthread.php?t=1709) or not, but it has some information that maybe be similar to what your are talking about when it comes to your display. The LCD that is discussed is a 40X2 LED backlit LCD. (There is a link to it on BGMicro). There are pictures of it in the posts. Also there is a link to a Hack-A-Day article with schematics for a Fast Serial Interface based on PIC controller along with the PIC code to make it work. Apparently this board will also work with Serial to USB adapter. I wanted to attempt to build the fast serial version but I do not have access to a PIC burner either.. :(

DaveW
01-17-2006, 09:05 AM
I don't know if you guys have Maplin Electronics in the US, but there's one near to me (one advantage of living near the biggest commercial city in Scotland) and it's selling a USB interface module. It's just a board that interfaces with the USB port with plenty of output and input lines. It it has enough output lines and input lines, then this could be a good thing, it might be able to interface properly with a LCD display. Thanks for the link, i'll have a look at that USB serial interface-it might be the answer to my prayers.

Servo motors are pretty expensive, and the door i want to open's going to be tiny-i was thinking about changing it to a tiny 3V motor or something and hooking up a little gearbox, with a contact that closes when the door is fully open and stops the motor. Then when the case powers down, i can just do the same thing in the opposite direction. The problem is it's going to take a couple more pins to set that up unless i do something really clever. The main problem is it's a sliding door. I've been thinking about mechanisms, and i think a sort of rack and pinion idea would be the way to go-any feedback on this would be appreciated. Thanks!

-Dave

DaveW
01-17-2006, 09:19 AM
I've also had another crazy idea. I've got an old digital camera that doesn't work properly, anyone know how easy it would be to take the LCD screen out of that and use it? It's a graphic display, but in theory the interface is allready there...nah, that's just fantasy stuff, right? ...right?

crazybillybob
01-17-2006, 10:42 AM
Servo motors are pretty expensive, and the door i want to open's going to be tiny-i was thinking about changing it to a tiny 3V motor or something and hooking up a little gearbox, with a contact that closes when the door is fully open and stops the motor. Then when the case powers down, i can just do the same thing in the opposite direction. The problem is it's going to take a couple more pins to set that up unless i do something really clever. The main problem is it's a sliding door. I've been thinking about mechanisms, and i think a sort of rack and pinion idea would be the way to go-any feedback on this would be appreciated. Thanks!

-Dave

Dave,
We don't have Maplins here in the states (I wish we did, It's getting harder to find retail electronics parts and equipment here...The internet is our friend!)

As for Servo's being expensive....? you can pick up a new one on Ebay for $12-15us for a standard size, less for smaller. And some of the UK guys sell them even cheaper! and you can run it on 1 I/O line (supply 5V and Gnd from Rails, and you just need the signal from the PIC) you only need a few oz so a standard will be more then enough. Now for the Sliding doors take a look @ Crimson Sky's Doom 3 Mod (http://thebestcasescenario.com/forum/showthread.php?t=1) He used some parts from an old CDrom drive to make a Roll up (think Garage door) blast window, and a Clamshell Air lock (the air lock is driven with a servo) , this should give you some more to think about at least in designing the moveing parts of the doors.

As for the LCD from the Digi.....More work than it's worth! You'd have to figure out how to drive it as most camras don't use a standard protocall to control the screens (ie not VGA or USB or Serial). You could pull it and see if it has it's own control chip, then look around to see if some one has an interface board (the interface boards to make say a laptop lcd work on your pc VGA are $200-$500 US...not very practical when a new 15" desktop LCD is $199 and will fit in the same places with a bit of modding!)

Keep the Ideas flowing!!

Crazybillybob

DaveW
01-18-2006, 07:44 AM
Well, maybe you're right about the servo. I'm just fiddling with ideas and prices right now-trying to work out what i can and can't afford. The door on the front's pretty small, we're talking maybe an inch and a half square, so it seems crazy to spend £10 (about $15 i think) on a servo just for that. Then again, people are always asking why we're modding in the first place, and i guess that makes craziness relative. So here's a thought: if it's worth doing, and it is, then it's damn well worth doing right. I'm kicking these ideas around right now because i want to have this budgeted and damn near on perfect. I've got my drawing board out and i'm drawing up full sized plans for the front end, which i would scan in and show you guys but i don't have an A3 scanner, and it's not finished anyway. I'll post up my plans soon enough.

I knew i was dreaming with the camera LCD anyway :) But hey, we all gotta dream :)

I'm thinking of opting for a smaller sized LCD now, because i'd really need a 6*20 LCD to make this work the way i want it to. So i think i might chop this down to a 2*20 LCD and put an analogue Voltmeter underneath it. A nice one with a swinging needle. I'd just hook this directly into one of the PSU's lines, any ideas? I'm worried about getting a Voltmeter wide enough, so i could get a Voltmeter and a Ammeter and put them right next to each other, which would be good. One thing i'm not sure off is if there's a power line from the CPU to the PSU-does the Motherboard control the power provided by the PSU, or does it take all the power the PSU has to offer and then transform it into whatever the CPU is set to receive? (I know that that's bad use of 'Transform' but i think you get what i mean)

I allready saw the Doom3 Mod, it was inspirational; I honestly wouldn't have come up with the door idea, or at least, i never would have thought it a possibility, if it hadn't been for that mod.

Whoops, gotta go-thanks guys!

-Dave

DaveW
01-23-2006, 09:24 PM
Right, i've figured out how to control the Fans. I use a multiplexer with different resistances on each line. I then use the select line and the PIC to control the speed of the fans. I also think that i've got the door sorted out now. I think i've almost got it! I placed a hefty order today of around $1200 to get new equipment for me and some other folks, so i'll soon have the hardware to make my first mod project, to house my new hardware, a reality. Once i've perfected my techniques on that baby, it'll be time to make this dream box into a reality. This is going to be ages away yet, but i'm holding out, and not giving in. I want my first box to be a roaring 100% success, and it's going to need to be if i want a chance in hell of getting this dream of mine to come true. Watch this space.

-Dave