| View previous topic :: View next topic |
| Author |
Message |
Squall333
Joined: 28 Apr 2005 Posts: 91
|
Posted: Fri Nov 30, 2007 1:09 am Post subject: Psp and electronics project, need help |
|
|
Hello. Im working on a little project for my car that involves my psp using lua as a computer. I need to be able to have serial in and out which im told lua can do.
Anyway i need a 5v analog to digital converter and a 0-5v digital to analog converter. Im pretty new with the electronics part so im not sure what kind of converters i would need. Im using a MAP sensor that has a 5v output which i would like to display on the psp. Also i have a pressure solenoid which takes a 0-5v input which i would like to send from the psp. Any help on any of this is very appreciated. |
|
| Back to top |
|
 |
deniska
Joined: 17 Oct 2005 Posts: 71 Location: New York
|
|
| Back to top |
|
 |
Squall333
Joined: 28 Apr 2005 Posts: 91
|
Posted: Fri Nov 30, 2007 5:09 am Post subject: |
|
|
| That really has nothing to do with ADC's at all. Finding the right ADC is proving to be the hard part. Im guessing theres such thing as a DAC also? Im not sure. |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Fri Nov 30, 2007 5:30 am Post subject: |
|
|
I'd forget about LUA if you intend to use the serial port.
It works until you expect to recieve a continuous stream of data
where it chops in and out, and you miss many characters.
For the rest, it sounds like you need to take up programming microcontrollers as well.
One chip could do the rest, and even buffer the serial line so LUA might handle short strings.
The only extra hardware after getting the microcontroller running would be a darlington transistor
to switch a high current 5 Volt supply for the solenoid.
Art. _________________ If not actually, then potentially. |
|
| Back to top |
|
 |
deniska
Joined: 17 Oct 2005 Posts: 71 Location: New York
|
Posted: Fri Nov 30, 2007 9:24 am Post subject: |
|
|
| Squall333 wrote: | | That really has nothing to do with ADC's at all. Finding the right ADC is proving to be the hard part. Im guessing theres such thing as a DAC also? Im not sure. |
My bad, somehow I thought you just wanted to boost the voltage with one of those RS232-TTL converters.. |
|
| Back to top |
|
 |
Squall333
Joined: 28 Apr 2005 Posts: 91
|
Posted: Fri Nov 30, 2007 9:49 am Post subject: |
|
|
| There is a micro controller that is used with the Megasquirt (www.megamanual.com) that is a 68HC908 processor. It has the ADC's built in and comes pre programmed. The hard part would be then controlling that via psp's serial port. Also what exactly is used to control voltages digitally. The solenoid uses 0-5 volts to open and close a valve. How can i control that via psp? |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Fri Nov 30, 2007 10:42 am Post subject: |
|
|
Talking to the microcontroller isn't hard with the PSP, but you might
need the RS232 converter for that.
There are ways to do that digitally, by connecting IO ports through different
value resistors to a common point, and by toggling combinations of IO
outputs through the resistors, you can make what's called a resistor ladder.
Again, depending on the application, pulse width modulation might be the way to go,
and again, achieved digitally.
WHen I use analogue ports, it's of rin, not out.
You could use a digital potentiometer which is another cheap chip which
works like a normal pot, but it's controlled with commands from the microcontroller. _________________ If not actually, then potentially. |
|
| Back to top |
|
 |
Squall333
Joined: 28 Apr 2005 Posts: 91
|
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Fri Nov 30, 2007 12:54 pm Post subject: |
|
|
You can probably turn on the USB port and get 5 Volts from the
contacts that power the chotto cam.
but I wouldn't drive a solenoid with it without a darlington transistor
and external power.
It would be possible to have the PSP turn on external devices with a timer
that way. I will be testing that method shortly, but ideally want two outputs,
so hopefully something sneaky can be done with the data line of the USB port,
or a seperate IR receiver will work.
For the PSP, recieving and interpreting an analogue input is a bit complicated
because the microphone is the only analogue input you can access without
opening the unit. _________________ If not actually, then potentially. |
|
| Back to top |
|
 |
Squall333
Joined: 28 Apr 2005 Posts: 91
|
Posted: Sat Dec 01, 2007 11:15 am Post subject: |
|
|
| The psp would be controlling the solenoid digitally because of the DAC. I have to figure out where to get the 5v Vref's from. Also do you recommend using C instead of lua? |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Sat Dec 01, 2007 5:29 pm Post subject: |
|
|
If you're talking to me I recommend using LUA as a stepping stone only.
I don't recommend using LUA for any program that needs to use the serial port.
In that special case PSP LUAplayer is a particularly bad choice.
I haven't used it for two years or so, but I don't think anyone has addressed the serial port issue yet.
You can't do anything to slow down the transmission from a device you're
not writing the software for, like your car's trip computer, or ECU or whatever
you want a serial communication from. _________________ If not actually, then potentially. |
|
| Back to top |
|
 |
Squall333
Joined: 28 Apr 2005 Posts: 91
|
Posted: Sun Dec 02, 2007 3:58 am Post subject: |
|
|
What exactly is the problem with lua and the serial port? I wont be reading data from an ECU or anything else. The data would be coming from the ADC then it would be sending data back out to the DAC.
Edit: Do you mean like changing the baud rate? Im not sure thats the same thing but im going to read up on it and find out |
|
| Back to top |
|
 |
Jim

Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
Posted: Sun Dec 02, 2007 8:46 am Post subject: |
|
|
LUA polls the serial port so slowly it misses some of the incoming bytes. You either need to poll faster, or, I guess there's an interrupt you should be looking at.
Jim _________________ http://www.dbfinteractive.com |
|
| Back to top |
|
 |
Squall333
Joined: 28 Apr 2005 Posts: 91
|
Posted: Sun Dec 02, 2007 11:17 am Post subject: |
|
|
| How slowly is so slowly and how many bytes does it lose? |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Sun Dec 02, 2007 8:17 pm Post subject: |
|
|
Nothing to do with the baud rate, it handles the speed it is supposed to work at for each byte,
but to get it to read in any strings there needs to be a rather large gap
in time between every byte being sent.
Slowing the overall communication down.
The amount of information you lose over a normal communication with a
serial device like a PC sending a text file is greater than the amount received.
If the ADC you are talking about is a chip that outputs serially,
then even in a message of two bytes, one would go missing a lot.
You can test the LUA serial terminal by trying to send text you copy/pasted
into Windows Hyperterminal.
The LUA serial terminal program works a littl ebetter if you remove the code that prints a dot every second. _________________ If not actually, then potentially. |
|
| Back to top |
|
 |
Squall333
Joined: 28 Apr 2005 Posts: 91
|
Posted: Mon Dec 03, 2007 11:47 am Post subject: |
|
|
| I guess ill try lua at first just because its easier. The data im sending isnt do or die. As long as it doesnt lose more than like 20% of the data id probably stillbe alright. I wont really know until im at that point. I tried to set up the pspsdk but it keeps saying make is an unrecognizable command so i have to look into that a little more. |
|
| Back to top |
|
 |
Squall333
Joined: 28 Apr 2005 Posts: 91
|
Posted: Tue Dec 04, 2007 1:03 pm Post subject: |
|
|
| Ok so the ADC i have outputs TTL/MOS do i need to convert that to rs232 before i send it to the PSP? |
|
| Back to top |
|
 |
Squall333
Joined: 28 Apr 2005 Posts: 91
|
Posted: Mon Dec 10, 2007 12:42 pm Post subject: |
|
|
| Im pretty sure the psp uses TTL so if im not sending it to my computer i dont need to convert it to rs232. It should be fine right from the ADC to psp right? |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Mon Dec 10, 2007 1:55 pm Post subject: |
|
|
You have to watch the voltage that you send to the PSP,
the ADC is probably a 5 Volt signal, where the PSP expects to see 2.5 Volts.
A series wired resistor will take care of that.
See Deniska's GPS docs for the value everyone settled on,
or start with a high value that prevents any communication at all,
and work your way to a lower resistor value that works. _________________ If not actually, then potentially. |
|
| Back to top |
|
 |
Squall333
Joined: 28 Apr 2005 Posts: 91
|
Posted: Thu Dec 13, 2007 3:20 am Post subject: |
|
|
| If i understand correctly TTL is just voltage that is turned on and off correct. So does it matter if its 5v on off or 2.5? What im asking is will the resistors interfere with the transmission of the signal? |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Thu Dec 13, 2007 6:41 am Post subject: |
|
|
No it won't interfere,
That's how GPS devices are connected.
You just don't want the PSP to see 5 Volts at it's input.
It might not hurt, but you don't want to find out. _________________ If not actually, then potentially. |
|
| Back to top |
|
 |
Squall333
Joined: 28 Apr 2005 Posts: 91
|
Posted: Fri Dec 14, 2007 12:41 pm Post subject: |
|
|
| A 1K resistor should do the trick right? |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Fri Dec 14, 2007 4:47 pm Post subject: |
|
|
Sounds right, but you could buy a few and try to go higher.
close to where communication stops being reliable.
They're only a few cents each. _________________ If not actually, then potentially. |
|
| Back to top |
|
 |
Squall333
Joined: 28 Apr 2005 Posts: 91
|
Posted: Mon Dec 31, 2007 3:24 am Post subject: |
|
|
| Ok so i have everything i need i took apart the headphones and the wires look wierd. Its like copper wound around string. Whats up with that? |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Mon Dec 31, 2007 6:58 am Post subject: |
|
|
| Squall333 wrote: | | Ok so i have everything i need i took apart the headphones and the wires look wierd. Its like copper wound around string. Whats up with that? |
AC signals flow along the surface of conductors, so there's no reason for a solid wire. Using strands of smaller wires gives you more surface area for a better signal, and better flexibility. Since you don't need a solid wire, but lots of smaller, thinner wires wound together, string is often used as a core to make the overall wire stronger despite using thin wires. |
|
| Back to top |
|
 |
Squall333
Joined: 28 Apr 2005 Posts: 91
|
Posted: Mon Dec 31, 2007 8:37 am Post subject: |
|
|
| J.F. wrote: |
AC signals flow along the surface of conductors, so there's no reason for a solid wire. Using strands of smaller wires gives you more surface area for a better signal, and better flexibility. Since you don't need a solid wire, but lots of smaller, thinner wires wound together, string is often used as a core to make the overall wire stronger despite using thin wires. |
Thank you for that information. How does the power and ground not short each other? |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Mon Dec 31, 2007 1:35 pm Post subject: |
|
|
| Squall333 wrote: | | J.F. wrote: |
AC signals flow along the surface of conductors, so there's no reason for a solid wire. Using strands of smaller wires gives you more surface area for a better signal, and better flexibility. Since you don't need a solid wire, but lots of smaller, thinner wires wound together, string is often used as a core to make the overall wire stronger despite using thin wires. |
Thank you for that information. How does the power and ground not short each other? |
Assuming the wire carries two (or more) separate signal paths, they'll either have another insulator between the two (or more) levels of braiding around the string core, or the individual wire strands will have an insulating coat. An insulator separating the inner braid from the outer braid seems to be more common in my experience. |
|
| Back to top |
|
 |
Squall333
Joined: 28 Apr 2005 Posts: 91
|
Posted: Mon Dec 31, 2007 2:03 pm Post subject: |
|
|
| I'm not looking at the wires now but i believe that they are all the same with no insulation between the power and ground. |
|
| Back to top |
|
 |
Squall333
Joined: 28 Apr 2005 Posts: 91
|
Posted: Tue Jan 01, 2008 6:12 am Post subject: |
|
|
| I think because of the lack of insulation i can't get a signal across the wires |
|
| Back to top |
|
 |
Jim

Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
Posted: Tue Jan 01, 2008 6:51 am Post subject: |
|
|
??? clearly the wires must be insulated from one another or the Sony gear wouldn't work. Admittedly they're very delicate, but, obviously, the copper in the sheath is isolated from the copper inside the core.
Jim _________________ http://www.dbfinteractive.com |
|
| Back to top |
|
 |
|