forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Psp and electronics project, need help
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Squall333



Joined: 28 Apr 2005
Posts: 91

PostPosted: Fri Nov 30, 2007 1:09 am    Post subject: Psp and electronics project, need help Reply with quote

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
View user's profile Send private message AIM Address
deniska



Joined: 17 Oct 2005
Posts: 71
Location: New York

PostPosted: Fri Nov 30, 2007 2:37 am    Post subject: Reply with quote

this thread seems to have all the answers:
http://forums.ps2dev.org/viewtopic.php?t=5234&highlight=serial+dummies
Of course you can "ask" the search function directly next time ;-)
Back to top
View user's profile Send private message
Squall333



Joined: 28 Apr 2005
Posts: 91

PostPosted: Fri Nov 30, 2007 5:09 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Fri Nov 30, 2007 5:30 am    Post subject: Reply with quote

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
View user's profile Send private message
deniska



Joined: 17 Oct 2005
Posts: 71
Location: New York

PostPosted: Fri Nov 30, 2007 9:24 am    Post subject: Reply with quote

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
View user's profile Send private message
Squall333



Joined: 28 Apr 2005
Posts: 91

PostPosted: Fri Nov 30, 2007 9:49 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Fri Nov 30, 2007 10:42 am    Post subject: Reply with quote

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
View user's profile Send private message
Squall333



Joined: 28 Apr 2005
Posts: 91

PostPosted: Fri Nov 30, 2007 10:54 am    Post subject: Reply with quote

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/03products/products_detail/AS1526/download/AS1526_datasheet.pdf
D/C
http://www.austriamicrosystems.com/03products/products_detail/AS1504/download/AS1504_datasheet.pdf
Back to top
View user's profile Send private message AIM Address
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Fri Nov 30, 2007 12:54 pm    Post subject: Reply with quote

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
View user's profile Send private message
Squall333



Joined: 28 Apr 2005
Posts: 91

PostPosted: Sat Dec 01, 2007 11:15 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Sat Dec 01, 2007 5:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
Squall333



Joined: 28 Apr 2005
Posts: 91

PostPosted: Sun Dec 02, 2007 3:58 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Sun Dec 02, 2007 8:46 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Squall333



Joined: 28 Apr 2005
Posts: 91

PostPosted: Sun Dec 02, 2007 11:17 am    Post subject: Reply with quote

How slowly is so slowly and how many bytes does it lose?
Back to top
View user's profile Send private message AIM Address
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Sun Dec 02, 2007 8:17 pm    Post subject: Reply with quote

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
View user's profile Send private message
Squall333



Joined: 28 Apr 2005
Posts: 91

PostPosted: Mon Dec 03, 2007 11:47 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Squall333



Joined: 28 Apr 2005
Posts: 91

PostPosted: Tue Dec 04, 2007 1:03 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Squall333



Joined: 28 Apr 2005
Posts: 91

PostPosted: Mon Dec 10, 2007 12:42 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Mon Dec 10, 2007 1:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
Squall333



Joined: 28 Apr 2005
Posts: 91

PostPosted: Thu Dec 13, 2007 3:20 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Thu Dec 13, 2007 6:41 am    Post subject: Reply with quote

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
View user's profile Send private message
Squall333



Joined: 28 Apr 2005
Posts: 91

PostPosted: Fri Dec 14, 2007 12:41 pm    Post subject: Reply with quote

A 1K resistor should do the trick right?
Back to top
View user's profile Send private message AIM Address
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Fri Dec 14, 2007 4:47 pm    Post subject: Reply with quote

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
View user's profile Send private message
Squall333



Joined: 28 Apr 2005
Posts: 91

PostPosted: Mon Dec 31, 2007 3:24 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Mon Dec 31, 2007 6:58 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Squall333



Joined: 28 Apr 2005
Posts: 91

PostPosted: Mon Dec 31, 2007 8:37 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Mon Dec 31, 2007 1:35 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Squall333



Joined: 28 Apr 2005
Posts: 91

PostPosted: Mon Dec 31, 2007 2:03 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Squall333



Joined: 28 Apr 2005
Posts: 91

PostPosted: Tue Jan 01, 2008 6:12 am    Post subject: Reply with quote

I think because of the lack of insulation i can't get a signal across the wires
Back to top
View user's profile Send private message AIM Address
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Tue Jan 01, 2008 6:51 am    Post subject: Reply with quote

??? 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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group