Prop on Order need tips on 5v logic
jbalat
Posts: 96
I will be trying to read a 5V square pulse 25Hz to 300Hz from the cars air sensor..
--> I understand I can hook that up with a 1K resistor in series and propellor should be ok ?
Then I need to send a modified signal to the ECU.. Not quite sure whether 3.6v from the propellor would work with the ecu ?
Because the input signal is always changing in frequency the pulses to the ECU need to transition very smoothly
Can someone help with a few lines of Spin code for this ?
Thanks
JB
--> I understand I can hook that up with a 1K resistor in series and propellor should be ok ?
Then I need to send a modified signal to the ECU.. Not quite sure whether 3.6v from the propellor would work with the ecu ?
Because the input signal is always changing in frequency the pulses to the ECU need to transition very smoothly
Can someone help with a few lines of Spin code for this ?
Thanks
JB
Comments
No one here could possibly help you with the code though. You have not given us anything to go on except "pulses" and "send a modified signal".
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
prop output pin 3 volts to a 74ls04 the 04 is connected to 5 volts I am sending 3 volts to the inverter input so would the output be raised to 5 volts? I understand the output would be flipped so a low input would be a high output but the question is the prop 3 volt output to 5 volt logic enough to trigger the gate?? thank you very much
74LS and all TTL by it's very nature will not swing to the supply rail so you will never get 5V, typically it will be 3.5V. If you use 74HCT logic then you will get full output swing and 2V input switching threshold. There are gates available in standard DIP, SOIC, and even tiny SOT-23 style packages. I use single 74HCT86s in SOT-23 as I can configure these as inverters or buffers (non-inverting). If you are using common 14-pin 74HCT04s then you can simply cascade two gates to give you an non-inverted output.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
An inverted signal is not going to be a problem since it is a continuous pulse of 50% duty
Is it worth trying without the 74LS04 just in case the ECU can read the Propellor directly ?
This is what the code looks like on a BS2 which is far too slow for this application and the PWMPal is hopeless because it retriggers when the frequency changes...
Main:
PULSIN 7, 1, time 'read freq from MAF sensor
time = time */ Scale 'allow for bs2p scale
OnTime = time / 25 'pwm time for half wave
OnTime = OnTime * 100 / mFactor 'Reduce freq by factor eg. 90 (%)
IF Ontime <> prevTime THEN 'Output new pulse via PWMPal to ECU
SEROUT 0, 45, [noparse][[/noparse]"!PWMM1", OnTime.BYTE0, OnTime.BYTE1, OnTime.BYTE0, OnTime.BYTE1]
prevTime = Ontime
ENDIF
GOTO Main
Post Edited (jbalat) : 11/20/2009 5:32:02 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
74HCT's are a little hard to come by around here (Australia)
Jaycar and Dick Smith are the main 2 stores.
This is the closest I could find...
7404 TTL Hex Inverter
But there are more choices if I search for 74HC
assuming this one is ok then how do I wire up 14 legs ?
Post Edited (jbalat) : 11/20/2009 12:33:58 PM GMT
You must have 74HCT or similar, there are also other ways, but 74HC or LS is not the go. I'm in Brisbane and I have never ever had problems getting any parts but if you only shop at those two places you will never have any luck. PM your address and I will send you some stuff out of my bottomless junkbox.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
You might want to consider the CMOS cd4050 hex buffer which is used a lot to interface TTL to Higher voltage CMOS circuits.· The output swing is determined by the pin 1 voltage. The input can be voltages other than this. see attached pdf.
ben
Peter... Which stores do you recommend, I am in Melbourne ?
Ben.. Have you used the cd4050 for this yourself Looks like this is available from Jaycar
www.jaycar.com.au/productView.asp?ID=ZC4050&keywords=4050&form=KEYWORD
Any ideas with the coding from stamp to spin ?
P.S. I really appreciate everyones help
Thanks,
John B
Post Edited (jbalat) : 11/22/2009 6:36:35 AM GMT
You could try Rockby. www.rockby.com.au/myindex.cfm and index www.rockby.com.au/Mainindex.cfm Looks like they have a range of HCT you could use (not the HCT04 strangely though), but you can use HCT32s and join the two inputs together, or 240s or 245 or even octal latches configured as buffers.
I'm in Adelaide and would buy about half my parts from Rockby and the other half from Futurlec. (Futurlec are a bit cheaper but can take up to a month to arrive). Hmm - I haven't been into a dick smith or jaycar for ages. Once upon a time when there was a new chip that is where you would go. These stores ought to be selling the Propeller!
FWIW I'm using HC 373s (not HCT) to go from a prop to 5V to drive a 5V LCD display and it is working fine.
4050 is another option. In fact there are many options and they all will work fine. Even a single transistor and two resistors if you are stuck for space. Sometimes it depends on what comes out of the junkbox first.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.smarthome.viviti.com/build
Post Edited (Dr_Acula) : 11/22/2009 6:59:34 AM GMT
The advantage·of "my" suggestion·is its preservation of I/O bi-directionality.· Is that of value?· I could get on a soapbox and evangelise, but I won't.
I've attached a schematic, which is the same as the PDF's, but it includes some resistor values.· I've tested this using BS170, 2N7000, VN2222L.
If you want nothing more than to interface a device's 0/5V output to a Prop pin input then why not just use a voltage divider, two resistors or a pot, to scale it down?··It doesn't·get any simpler than that, no active devices required.· (See attachment same.)
in relation to I/O bi-directionality..
My ECU supplies 5V down the line to the sensor.. Somehow the sensor pulses this 5V
In my application I would need to cut the wire from the ECU to the sensor and supply 5V to the sensor so it can pulse it. Then read the sensor pulse on the same wire. Then send a modified pulse back to the ECU
Sounds like this is the better circuit to use ?
As for the code (see earlier post).. I have downloaded a BS2 "Object" for the propeller which is supposed to let you use the pulsin and pulsout commands.. Is this slower than native spin ? How can I get the pulsin and pulsouts working on seperate cogs so that I dont have any glitches in my output ?
Post Edited (jbalat) : 11/24/2009 3:37:49 AM GMT
Post a link to your ECU, I'm sure everybody'd love to see it.
As for the PULSIN/PULSOUT query, perhaps start a new Subject all about that.
And some attachments from the Basic Stamp forum...
BTW my Propeller is here.. I will do the hello world thing shortly..
So what components do I need to order plzzzz ???
Post Edited (jbalat) : 11/25/2009 11:57:10 AM GMT
So instead of pulling it high to 5v pull it high to 3.3v with the resistor, you instantly have a 3.3v pulse train coming in to the propeller.
It then looks like you need to reduce the frequency and send it to the ECU, you could do this with a buffer/inverter chip as suggested or you could use a transistor and a pull up resistor, this time pulled up to 5v. You also want a resistor to the base of the transistor.
I can't see where any lines needs to be able to work in both directions but as I said I am guessing a little here.
Graham
I have just posted what I observe
- There is only one wire.
- The ECU sends 5V down this wire to power the sensor
- The sensor switches it on and off
- the ecu interprets the on/off pulse
If I cut the wire to intercept the signal from the sensor then I still need to feed it the 5V otherwise it wont work..
- So effectively the same wire from the propeller will be sending 5V and receiving the sensor pulse to calculate the frequency
- The output wire from the propeller will be getting the 5V from the ecu but it will be generating a new 3.3v pulse back
Does this make sense ?
You have misunderstood what is happening in the circuit and I did not notice the internal pull up in the ECU.
Pin three of the airflow sensor can do only one thing, it can switch a transistor on pulling that pin down to ground. This is called an open collector output, please look that up. The original ECU connects this pin to 5v (shown as a circle with a line through) via an internal pull up resistor and to the rest of its circuit via another resistor (shown by a wiggly line).
BUT it is not a question of it "providing the pin with 5v" it is just creating a simple circuit of transistor and pull up resistor. When the transistor is on the pin is pulled down to ground by the transistor, when it is off the pin is pulled up to 5v by the transistor in the ECU.
BUT the modified version with the wire cut shows the sensor pin pulled up to 5v via an external resistor. BUT this could just as easily be pulled up to 3.3v which would make the output of the sensor compatible with the propeller.
Once you have modified this signal in the propeller you need to send it to the ECU, to do this you just need to emulate the output circuit of the sensor, that just needs a single transistor. The base connected to propeller pin via a resistor, the emitter to ground and the collector to the pin of the ECU.
Please do read what I have written carefully, it means you only need two resistors and a transistor and you are cooking with gas.
Graham
If you could mention a transistor and resistor value then I can order some bits
Just a note though that when I cut the wire the ECU came back with 3 error codes and not 1.. ie. MAF sensor, IAT sensor and Atmospheric sensor.. Could this wire also be feeding the other 2 sensors with the 5 volts from the ECU ?
Just let me know if you think I am on Drugs [noparse];)[/noparse]
Not according to your diagram, you have a confused notion that you can supply 5v and get a signal back down the same line, look at the circuit it shows, the output is just a transistor. If it were a supply how would the signal be sent down it? If the pin pulses then it goes low high low so on every low power would be lost.
I have no idea about the other error codes but the diagram of the sensor and the ECU plus the way in which the other guy wired his stamp up suggests I am correct, the little diagram at the bottom even shows how the air sensor is acting like a switch to ground.
I have attached a little diagram to explain what I mean more clearly, the propeller chip is just diagrammatic, it takes in the air sensor signal at one side and outputs the modified version at the other.
The choice of transistor is not critical but the base resistor will depend on the transistor, I can't remember the last time I bought a transistor (the last time I used one it was a kludge with a BFY51) so I'm hoping others have some suggestions.
Graham
I hope you have not based too much on the Stamp Setup. That was my circuit I tried to use prior to purchasing the Propeller including the picture below it with the switch. It would work at certain revs but on the whole the car was not driveable.. The car would jump around like crazy but it did not register an engine fault.
I assumed it failed because the stamp was too slow and the PWMPal was retriggering therefore sending the ECU a screwy signal everytime the input changed
Hopefully someone can help with resistor values for your circuit above
Many thanks !!!!!! [noparse]:)[/noparse]
Post Edited (jbalat) : 11/27/2009 10:03:26 AM GMT
Rather than waiting you could look at this:
www.kpsec.freeuk.com/trancirc.htm
The section on "Choosing a suitable NPN transistor" is ideal. You can even measure the current that the transistor will be switching by connecting an ammeter from the ECU pin to gnd.
Cheers,
Graham
So on the Air sensor side we are basically working off 3.3v (VDD) via the 10k ?
On the ECU side...
From the link you gave me I calculated a resistor of about 660 ohms (I have 1K) using a supply voltage of 5V and a load current of 4ma (measured when I cut the ECU/MAF wire).
This gave a hFe(min) of around 4. Looking at the transistors page looks like anyone of them will do ?
So I will probably use a BC107 since I think I have one somewhere..
P.S. If you know anyone that wants to buy my stamp then pls let them know. ebay item 150394792459
Post Edited (jbalat) : 12/9/2009 12:50:02 PM GMT
I dont think the 3.3V on the Airflow sensor side was enough to get a signal back..
Subsequently there was no output from the transistor..(I used a BC337 with 1KOhm resistor)
I am going to try hooking up the Propeller similar to the stamp
5V to airflow meter running in parallel via 10K going to the input pin on the propeller
On the ECU/propeller output pin just connect directly via 2K resistor ?
Post Edited (jbalat) : 12/13/2009 10:42:06 PM GMT
Anyone see any issues ?
Just a minor mod to the circuit and a modification to the code to ignore any input frequencies that go astray due to noise (only allow 20Hz to 400Hz.)
Post Edited (jbalat) : 12/21/2009 12:42:27 PM GMT