Psp and electronics project, need help

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Squall333
Posts: 91
Joined: Thu Apr 28, 2005 5:32 am

Psp and electronics project, need help

Post by Squall333 »

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.
deniska
Posts: 71
Joined: Mon Oct 17, 2005 1:38 pm
Location: New York

Post by deniska »

this thread seems to have all the answers:
http://forums.ps2dev.org/viewtopic.php? ... al+dummies
Of course you can "ask" the search function directly next time ;-)
Squall333
Posts: 91
Joined: Thu Apr 28, 2005 5:32 am

Post by Squall333 »

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.
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

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.
deniska
Posts: 71
Joined: Mon Oct 17, 2005 1:38 pm
Location: New York

Post by deniska »

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..
Squall333
Posts: 91
Joined: Thu Apr 28, 2005 5:32 am

Post by Squall333 »

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?
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

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.
Squall333
Posts: 91
Joined: Thu Apr 28, 2005 5:32 am

Post by Squall333 »

If i can get an ADC that is compatible with the psp serial port i might not need that micro controller at all. I only need one in and one out at a time technically. The map sensor puts out a voltage from 0-5 which goes to the psp and then based on that the psp puts out a voltage from 0-5 to the solenoid. It doesnt really sound that complicated. I might be complicating it or i may be oversimplifying it. I guess i will find out. Which way do you guys recommend?

EDIT: i found these and im hoping they will work even if its in conjunction with something else

A/D http://www.austriamicrosystems.com/03pr ... asheet.pdf
D/C
http://www.austriamicrosystems.com/03pr ... asheet.pdf
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

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.
Squall333
Posts: 91
Joined: Thu Apr 28, 2005 5:32 am

Post by Squall333 »

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?
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

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.
Squall333
Posts: 91
Joined: Thu Apr 28, 2005 5:32 am

Post by Squall333 »

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
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

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
Squall333
Posts: 91
Joined: Thu Apr 28, 2005 5:32 am

Post by Squall333 »

How slowly is so slowly and how many bytes does it lose?
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

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.
Squall333
Posts: 91
Joined: Thu Apr 28, 2005 5:32 am

Post by Squall333 »

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.
Squall333
Posts: 91
Joined: Thu Apr 28, 2005 5:32 am

Post by Squall333 »

Ok so the ADC i have outputs TTL/MOS do i need to convert that to rs232 before i send it to the PSP?
Squall333
Posts: 91
Joined: Thu Apr 28, 2005 5:32 am

Post by Squall333 »

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?
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

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.
Squall333
Posts: 91
Joined: Thu Apr 28, 2005 5:32 am

Post by Squall333 »

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?
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

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.
Squall333
Posts: 91
Joined: Thu Apr 28, 2005 5:32 am

Post by Squall333 »

A 1K resistor should do the trick right?
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

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.
Squall333
Posts: 91
Joined: Thu Apr 28, 2005 5:32 am

Post by Squall333 »

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?
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

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.
Squall333
Posts: 91
Joined: Thu Apr 28, 2005 5:32 am

Post by Squall333 »

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?
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

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.
Squall333
Posts: 91
Joined: Thu Apr 28, 2005 5:32 am

Post by Squall333 »

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.
Squall333
Posts: 91
Joined: Thu Apr 28, 2005 5:32 am

Post by Squall333 »

I think because of the lack of insulation i can't get a signal across the wires
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

??? 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
Post Reply