Loved the video .... the sound brought back memories.
Loved the video .... the sound brought back memories.
.
It has taken a while but I have finally cracked the true Arduino analog output problem my project had, now hopefully my EFI project can move forward, or at least to the next road block.
Attachment 336823
My current EFI efforts to use an Arduino Nano to read the analogue signal from a MAP sensor in the crankcase and find the Difference between the Highest and Lowest reading and output the difference as an analogue pseudo MAP signal to the EFI (electronic fuel injection)'s CPU (central processing unit). Ran into problems when I found that the Arduino so called analog output was really just a PWM signal so pretty useless for what I wanted to do.
The Arduino talks about “analogue” output on their card but they are fibbing a little bit because it is really PWM, pulse width modulation and not analogue at all. So not at all useful for use as a true analogue output but PWM is pretty good for controlling electric motors, LED’s etc.
Attachment 336821
Arduino PWM (Analog) Tutorial:- https://www.arduino.cc/en/Tutorial/PWM
Attachment 336822 Attachment 336824
To get true analogue output with the Arduino Nano you need a DAC, digital to analogue card like the AdaFruit MCP4725 and AdaFruits software library add on.
Attachment 336826
AdaFruit MCP4725:- https://www.adafruit.com/product/935
AdaFruit Tutorial:- https://cdn-learn.adafruit.com/downl...c-tutorial.pdf
Attachment 336825
AdaFruit Library:- https://learn.adafruit.com/mcp4725-1...g-with-arduino
Hopefully I will get to try it all out on my bike over the weekend.......![]()
Isn't this all you need?
https://learn.sparkfun.com/tutorials...tal-conversion
![]()
Kinky is using a feather. Perverted is using the whole chicken
No ...
Great site though, thanks.
ADC, analog to digital conversion is for reading an analogue signal into the microprocessor. All the Arduino's have this.
DAC, digital to analogue conversion is so a microprocessor can talk out to the real world in the same way that we see/hear things.
Only the Arduino DUE has that and it's a 3.3 volt system so useless for 0-5 Volt signals. All the other Arduino's call their digital PWM output, Analog. But its not, it only pretends to be.
PWM is like Analog, well maybe to a blind man galloping past on a camel. PWM is totally useless if you need a real analog signal.
I thought the Map sensor just fed out a raw Voltage signal? So what does that circuit i posted do to them because i am well confused? does it just chop them?
i remember years ago there was a circuit that Dick Smith used to sell when it was just a shop like Radio shack it was used to drive CRO oscilloscopes etc Dick smith used to sell it on the basis it would turn voltage into a digital signals that could be modulated i think it was a function generator? this was years ago mind you so i might be a little fuzzy.
![]()
Kinky is using a feather. Perverted is using the whole chicken
Chops them.
The Arduino reads analog in Ok but outputs a chopped (PWM) on/off signal at varying frequency. Just the "On" time varies so its suitable for electric motors etc. Much like a VSD.
For a 5 Volt Arduino.
The Analog input is a voltage that changes to anywhere between 0 to 5 Volts. ........... Green Line
The Output is PWM and it is either 0 Volts or 5 Volts, only the "time on" changes. ....... Red Line
Analog is the green line and PWM the red.
The MAP sensor outputs a green line. I think the MAP sensor is "Piezo capacitive", anyway it is a 3 wire device with some circuitry so it gets 5 Volts in and outputs a varying analog 0 to 5 Volt signal that represents manifold pressure. Also MAP sensors measure absolute pressure as opposed to gauge pressure.
The EFI's CPU expects and understands a green line, not a red one, with a red line all it sees is 5 Volts.
TZ: a PWM signal is a volume signal, to compare it with water. There is a fluctuating hose (the PWM signal, timeslice * voltage), with a restrictor, to control the flow, flowing in a leaking barrel, resulting in a variable level in the barrel. The restrictor (output to barrel) and the leak (barrel to ground) are resistors, the barrel is a condensor. You're 3 parts away from a PWM---DAC, the size of the parts a compromise between ripple and response time.
Yes, Carel H, great analogy I like it. I have tried making low pass filters for converting PWM to Analog, but not very successfully.
Basically I was trying to smear out a 5 Volt. square wave of varying frequency to look like a contiguous liner wave of varying voltage with a simple IC circuit. I couldn't make it work well enough to be useful.
A fixed square wave with varying frequency has a fixed "volume", but a different ripple. But what are you trying to achieve? It looks like you're trying to read an analog signal by outputting an analog signal.
By the way, if you have pins left over, you can build your own DAC, it's also just a handful of resistors. And yes, I don't like analog too.
Yes, if I had 12 spare digital pins and 12 different value resistors I could have a 12 bit analog output by turning each on in turn. Simpler maybe, and just as effective as the MCP4725 12bit analog add on card.
I am trying to read in an Analog signal from the MAP sensor, process it and then pass it out as an Analog signal to the EFI's CPU.
The Ecotrons EFI system expects a MAP signal from the inlet manifold. This is Ok for a 4T but does not work well on a 2T. Which limits a 2T to only using an Alpha-N map which I have found is problematic at low throttle settings below 25% with my 110cc tuned 2T engine.
Alpha-N maps are RPM/Throttle position = Fuel required. Simple and work well with predictable air flow.
My idea is to find the difference between maximum and minimum crankcase pressure each cycle and output this in a modified form to the EFI CPU as an indication of real airflow through the two stroke's motor.
If I can find a good way to indicate changes in air flow (charging efficiency) then I may be able to also use a Volumetric efficiency map below 25%, just like 4T's do.
When the engine is on the pipe, Alpha-N works well but when the motor is swapping between on the pipe and off Alpha-N is either correct or to rich for the motor to run. So we need a way to adjust the fueling to match the changeable air flow.
Volumetric maps are RPM/Volumetric efficiency of the motor depending on manifold pressure as measured by a MAP sensor = fueling required.
As Volumetric efficiency (a 4T concept) is directly related to "Charging plus Trapping" efficiency (a 2T concept) then knowing the air flow should be a great help. But 4T methods of measuring air flow don't work well on tuned 2T's.
The plan is to use a Volumetric efficiency map below 25% throttle position and Alpha-N above 25% similar to a 4T approach and a 2T friendly way of seeing changes in air flow.
![]()
In my test setup the MAP sensor is the Analog input. The Arduino processes this Analog input and sends a 10bit value to the MCP4725 card. The meter is measuring the Analog output produced by the MCP4725 add on card.
The on/off/on toggle switch simulates the ignition trigger pulse for timing the start/end of each cycle by allowing a digital input pin to go high briefly. The trigger is connected to a digital pin configured as an interrupt. The MCP4725 feeds directly to the meter and it is also read by the Arduino on another Analog input pin so all inputs, outputs and internal processing variables can be serial line printed in real time to the PC's screen for de bugging purposes.
It has taken a while to learn about Arduinos and programming them and of course, at the moment it is just a concept and I have no idea if this is going to improve my 2T's EFI system or not until I try it.
READ AND UDESTAND
Hopefully that MAP signal will be an indication for the inhaled air mass. But if you rev the engine beyond the rpm allowed by its blowdown time.area, spent exhaust gases may cause a pressure rise in the crankcase that will easily exceed the highest useful reading, although it has nothing to do with the air breathing...
Bookmarks