1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Welcome To LandyZone!

    LandyZone is the biggest Land Rover forum on the net. We have plenty of very knowledgable members so if you have any questions about your Land Rover or just want to connect with other Landy owners, you're in the right place.

    Registering is free and easy just click here, we hope to see you on the forums soon!

MAF Amplifier - home brew = Leccy projects for the so inclined....

Discussion in 'Land Rover Freelander' started by Joe_H, Aug 12, 2016.

< Previous Thread | Next Thread >
  1. Tim4x4

    Tim4x4 Well-Known Member

    Joined:
    Dec 15, 2013
    Posts:
    2,181
    Likes Received:
    229
    Location:
    In the shed
    Thank you Joe your input is most welcomed.
    I am going to have a go making the amp and trying it out and seeing the readout using the diagnostic reader.
    One more thing (going to show my lack of electronics knowledge), you refer to the op-amp as a OPA350 what does the 350 refer to?
     
  2. Joe_H

    Joe_H Well-Known Member

    Joined:
    Dec 30, 2015
    Posts:
    1,486
    Likes Received:
    252
    Location:
    Brit in Northern Portugal
    Hi Tim, it is simply the manufacturers designation, it doesnt mean anything at all apart from using it as a method for ordering one.
    Here is a link to RS in the UK - I chose it simply because it was rail to rail operation (the output voltage can go from almost 0 to almost 5V - it can be ordered in a unit if 1. It is in a PDIP 8 pin package (easy to handle and works with - not surface mount. and it is 5V capable supply (single as opposed to dual rails.
    There are many others that would fit the bill ok.
    http://uk.rs-online.com/web/p/operational-amplifiers/6605557/

    We will need to use a 12v supply in the vehicle from the maf connector - so need to reduce it to 5V - best to use a 78L05 voltage regulator, look it up - really easy to use - 1 x 3 pin tiny regulator and 2 capacitors and that is our power supply.
     
  3. Tim4x4

    Tim4x4 Well-Known Member

    Joined:
    Dec 15, 2013
    Posts:
    2,181
    Likes Received:
    229
    Location:
    In the shed
    Again thank you Joe and I will now be getting on with making it.
    Oh but first I will sit through this
    EEVblog #600 - OpAmps Tutorial - What is an Operational ...
     
  4. Joe_H

    Joe_H Well-Known Member

    Joined:
    Dec 30, 2015
    Posts:
    1,486
    Likes Received:
    252
    Location:
    Brit in Northern Portugal
    :) excellent Tim.. For testing use a bigger piece of vero board then you think you will need as it makes thing easier. If all works well for you can can make another reusing most parts. Get an 8 pin DIL socket for the Op-amp. http://uk.rs-online.com/web/p/dil-sockets/0813115/ (these are the best type - they are 'turned pin' and much better quality than the cheapo 'slot' type pin locators.

    Op-amps are simply marvellous things. A veritable building block for loads of projects.
    Nowadays though, it rapidly becomes the case that instead of building analogue circuits it is easier, cheaper and faster to use digital microprocessor based boards such as the ones I linked to earlier. In a lot of cases, you do not need to know how things work, for instance - how an op amp actually works - but is is educational. mostly you just need to know what you can do with them and what the most important specifications are so you can select the right one.
    With the digital boards I linked to, you can have many analogue input (varying DC voltages are what we are looking at) into the board as the microprocessor has all the circuitry for analogue to digital converters built in. You can also select what type of function you want for most pins - such as a digital input (0 or 5v) - a digital output - () or 5V), analogue input 0 to 5V and anywhere in between.. and n easy way of also producing an analogue OUTPUT signal .. for this we use PWM (google - is useful as a lot of circuits in our vehicle ECU controls use PWM - very useful to have a grasp of!) . anyway - back to the little micro board. we have analogue input - so now we will want analogue output - what we do is to use the on board PWM outputs of the microprocessor to generate a PWM signal. By using a simple RC circuit (resistor and capacitor) we have an analogue output dc voltage that is proportional to the PWM duty cycle (sounds complex, but really isn't)
    We can then replace the op amp circuit with a microprocessor board, connect the input to any analogue input pin and the output to a PWM output pin.
    Our code then simply needs to do the following in a continuous loop. Read voltage at input, decide what to do with it, for example, apply a 'gain' (if we want a gain of 1.1 we simply use math to multiply the value of the input by the gain.. something almost as simple as this for the cose (and it really is almost this simple)
    Read input_voltage on pin 1
    Check what gain is requested (Gain_Value) - in this case 1.1:1
    output_voltage = input_voltage * gain_value
    // now send it out to PWM . where PWM_duty_cycle = (output_voltage / 5) * 100 (%) 5 because 5 is our max voltage
    PWM_Out = PWM_duty_cycle
    do it all again..
    ----------------------------

    as you can see it is fairly simple (especially once you get your head around pwm.)

    Also, you may be able to see that by adding a few steps we can examine the input voltage level, compare it against a preset 'lookup' list and then pick an output voltage based on the value in the'lookup' list...
    What you have now is a 'map' of input voltage to output voltage so it can be totally non linear. you can peak it in the middle, make it exponential, make the output levels do anything you want.. again similar to an ecu map. If you are looking at rpm and a voltage, you have a 2 axis lookup - for example 16 values of rpm and 16 values of voltage. a 256 unit 2 axis map - as per ecu maps again. you can tweak and alter anything you want in there.

    then to make things even better, you do all this to multiple inputs and output at the same time.
    You can even take one 'map' value and compare it to another map value and use the two results to produce a third.
    Marvellous stuff and the whole board with full micro unit, usb etc, a full computer on a board - is only a couple of quid...

    Joe
     
  5. 4Bee4Bee

    4Bee4Bee Well-Known Member

    Joined:
    Oct 24, 2015
    Posts:
    305
    Likes Received:
    103
    Location:
    Shropshire
    Great thread Joe.
    I've worked with PICs in the past too as part of the day job. The Arduino development tools and community seems to be huge though with there being a solution, either ready made, or adaptable to virtually any type of problem. One of the projects I want to do when I finally get some time is putting several temperature sensors around the vehicle, (rear diff, VCU, IRD etc), so I can have an early warning of any issues. The Dallas DS18B20 ICs, (and equivalents), run on a 1 wire interface operate from -55C to +125C, with a decent level of accuracy. Some eBay/Amazon sellers have them as waterproof probes for just a few £. If anyone fancies dabbling with the Arduino development boards mentioned above, most should be capable of having a string of these temperature sensors connected to 1 of the input pins. - and still be doing the MAF sensing/mapping stuff too.
    As well as RS, on the high street, Maplin sell a number of starter kits, that you can go into the shop and see firsthand.
    Jim
     
  6. Tim4x4

    Tim4x4 Well-Known Member

    Joined:
    Dec 15, 2013
    Posts:
    2,181
    Likes Received:
    229
    Location:
    In the shed
    Wonderful information Joe,
    I will firstly get the amplifier working and see what the effect it has on my vehicle. As I said not looking for more power than std but just to trim the diagnostic readings to within the limits specified by the manufacturer and see what it should drive like.
    Reading your post has stirred me into getting more information on the digital microprocessor and its application's.
    Your enthusiasm for electronics is infectious, I cant wait to get started.
    NOW LOOK WHAT YOU'VE DONE ;);)
     
    Joe_H likes this.
  7. Joe_H

    Joe_H Well-Known Member

    Joined:
    Dec 30, 2015
    Posts:
    1,486
    Likes Received:
    252
    Location:
    Brit in Northern Portugal
    Hi Jim, yes, the Arduino is excellent and as you rightly say, has a cut and paste library or code sample for virtually anything one wants to do. The community is fantastic as is the on line info. Most of my coding is with PIC Micros (and also when I programmed commercially it was ALWAYS pic micros). I used to (and still do !) use the rather excellent Crownhill PDS (Proton development system / IDE) for the PICs, however, this is not cheap and also ready made embedded pic boards are not available at any decent price. Also, the Arduino and clones are simply perfect for anything one can think of doing. I mean, 2 quid for the Nano Arduino ! 16mhz Processor and 5V operation -WITH usb.. amazing - simply amazing. No PicKit programmers needed etc. - just plug and play with USB and the excellent totally free arduino IDE.
    The temp measuring is a good thing to aim for. I have used the 1 wire protocol dallas units in the past. Pretty darn good :)
    I also considered adding small hall sensor to the sense the VCU output fixed yoke parts to give an indication of speed difference front to rear. you could get early warnings of tyre pressure issues etc and also see the actual point of VCU 'Hump mode' it would be interesting (certainly for a geek like me lol)
    What did you use to program PIC units ? MPLABS ? - I am not a fan of C based languages I must confess. I don't mind the PDS stuff and have no issues with assembler as I was brought up on Z80 assembler. (showing my age ;). I am happy with the implementation on the Arduino though as it is so logical and rarely do you need to go low level at all.
    There really is little one cannot do. I hope some of us can get together and swap ideas and code. That would be great.
    Joe
     
  8. 4Bee4Bee

    4Bee4Bee Well-Known Member

    Joined:
    Oct 24, 2015
    Posts:
    305
    Likes Received:
    103
    Location:
    Shropshire
    I started out with MPASM, a PICStart and the UV erasable 8-bit 15C5X series. (showing my age now!) When the flash programable 16F84 came along it was huge step forward!
    In commercial environments moved onto using PIC ICE and several other ICE tools, but mainly used the 8 bit processors, and used assembler to squeeze every last drop of performance out of them. Now I use MPLAB and a PICKit for the dabbling that I do with the 8 and 16 bit processors still. (I bought a PIC32 dev board some time ago for a project, but have never got around to using it). Things have progressed at a huge pace in recent years. ARM processors on boards with USB, bluetooth, ethernet, and SD cards, all for £20-£30. Massive amounts of processing power.
    I tend to use C/C++ nowadays, but still can't help feeling in doing so, stuff is being wasted on the chip. It can be hard at times not to slip back into the ASM mindset, when writing something in C++, thinking about optimisations etc., when really it does not matter, with all the processing power and memory available on a device. At least though you can still dip into ASM when needed to do some low level stuff. But it is rarely a problem nowadays.
    Yes a hall sensor on the VCU would be a very nice tool. Someone on here did get a couple of ready made rpm meters hooked up to the propshaft about a year ago, and found some interesting results.
    I keep looking at the clock space in my hippo, thinking that it is perfect to replace with a little display. I've got a TD4 manual, so no cruise control option, so could fit the cruise control buttons to the righthand side of the steering wheel and use those to control the gizmo in the clock space. First I want to get my stereo controls back to working with an aftermarket Pioneer I fitted. I found some info on the inter web thingy about what voltages control the head unit. I know you can buy these adapters that do it, but I want some more flexibility about what I can control from the wheel.
    Plenty can be done. I just need to get the time to do it! :)
     
  9. Joe_H

    Joe_H Well-Known Member

    Joined:
    Dec 30, 2015
    Posts:
    1,486
    Likes Received:
    252
    Location:
    Brit in Northern Portugal
    Yikes Jim, you were even before me on the pics :) - my first pic programming was the 16C84 OTP - for copying videocrypt tv decoder cards :)
    I still use ASM in virtually every pic program - especially in the interrupt routines where it is essential.
    I also condier the clock as mine has a (non working) wide unit in it - the 8 pin. This is perfect size for a 2 * 16 line LCD display.
    I LIKE the idea of the wheel controls for function select... nice one. :)
     
  10. 4Bee4Bee

    4Bee4Bee Well-Known Member

    Joined:
    Oct 24, 2015
    Posts:
    305
    Likes Received:
    103
    Location:
    Shropshire
    The 16C5X series were a pain. You had to erase them in a UV oven ahead of each program cycle. Even when having 3 on the go, you'd get to a point where you were waiting for the chip to finish erasing. When the flash versions came along it was such a luxury! - I'm sure a ton of those chips ended up decoding tv cards, and also the 12C series unlocking Playstations :)
    For time critical interrupts in embedded systems, I still swear by using assembler. - You can control the timing down to the finest instruction cycle.
    Yes, I agree, the 2x16 char display would go nice in that clock space, and work under all lighting conditions well. The steering wheel controls are nothing more than a couple of resistor values that change depending on the button state, so could easily be interfaced.
     
  11. Joe_H

    Joe_H Well-Known Member

    Joined:
    Dec 30, 2015
    Posts:
    1,486
    Likes Received:
    252
    Location:
    Brit in Northern Portugal
    Hi good folk..
    Ok, a small update as to work do far.

    I have transferred the main task to a simple Microprocessor (in this case an Arduino UNO) simply because I have a few .... My main expertise is in Microchip 'PIC' embedded processor programming, however, the Arduino is proving quite adept at doing the job and is fairly easy to got one's head around.
    So, what we have is a unit (the arduino UNO R3) that costs less than 3 quid from China. - and a few op amps - and we are good to go. Now, when I say 'good to go' I mean in all aspects - Fuel pressure regulation and tuning, MAF adjustment and amplification / tuning, rpm Sensing. VNT turbo tuning if needed - almost anything/ All in one package. The UNO R3 is a development system, the same thing can be bought in a vastly miniaturised form for a few quid.
    This allows us to program a lot of internal 'maps' of input Voltage from the sensor to output voltage from the sensor, and have multiple /maps/ to chose from to suit any need you want..
    The main thing is that it is digital, it is cheap, it allows FULLY non linear mapping of in and out values. It allows adjustment for low or med or high output 'increase'
    It can do multiple things at once - ie - one unit can control all desired options.
    It is REALLY simple for the home user with an even basic understanding of a circuit diagram and soldering to build. All the main work is in the software / firmware which I will probably release into the public domain (or certainly to forum members) - I have no doubt it will be copied at some time - but hey..... What I WILL do is enable the individual user here to SIMPLY tweak the maps as they require (for their own use !) with not too much knowledge.
    Yes, it all requires a basic - very basic - knowledge of HOW the sensors work in relationship to the ECU / DCU - beyond that, a way of judging where and when adjustments to the 'tweaked' curves need to be made (does it smoke at X revs at X throttle etc) - not too difficult - all the programming stuff is free, it is simple to use, you only need to alter a few parameters as you deem fit. NO you do not have to be a programmer as the work is done for you. YES it is far more adjustable than ANY commercial unit. Yes, it means adding a few wires from the unit to the loom, but that is simple - NO, you do not get commercial plugs to simply plug it in.
    However, what you DO get is a unit as good as anything out there with the ability for YOU to adjust it - or, for other users more knowledgeable to adjust and tweak and then - for YOU to copy. Win Win. - share share !.. Early days at the moment but the main core processing work is done. Just playing with a few mapping equations. :rolleyes:;)
    ALL In one unit - rpm sense, Fuel pressure adjustment, Maf adjustment - (Possibly - VNT adjustment - I say Possibly as it is easy to do - but - I do not want to tread on a very good friends toes !)

    Next steps -
    What I NEED is information !
    L series - no worries. !
    TD4 - well, yes, I NEED someone with a data reader that can record multiple sources of info and play back the same. My Lynx can do that do worries. I have no idea is the i930 or the Hawkeye can do the same ?
    I 'COULD' lend my lynx to the right person - however I am in Portugal and someone would have to stand the cost of shipping both ways AND full insurance.
    The MORE data we have the easier it is to produce the appropriate 'maps' - the hardware is P!SS easy !.
    Regards
    Joe

    Test rig - on sofa while Doris is out :D (Fer fecks sake don't tell her !!!:eek:)

    Multi- Meters - you need a few VERY good quality at this stage - Extech 570A, Hibok 55C, (and a mediocre Uni-T UT118A)
    In the pic - Arduino UNO R3 - where map is equal - Rin = Rout. A few odds and sods ofcomponents to simulate the sensor to ecu link

    Deep joy ;)

    And yes, the HIBOK 55C is a superb DC Clamp meter for DC current (up to 700A!) - amazing bit of kit I have had since my marine electronics repairs pseudo 'job' :) There are PLENTY of AC Clamp meters for sale - but look for a good quality DC unit ?? - rare as rocking horse SH!T...:oops:

    Ayyway, progress is being made, I cannot guarantee a 'continued' development timescale as you get whatever I have time to do and also whatever data I receive. But, we will get there.
    There is always the easy possibility of making a few PCB units for a few quid although I am not convinced they are needed - but hey..... possibly even an LCD display with adjustable 'map' curves via button push... all it takes is time and data......o_O

    UNO-TEST 1.JPG
     
    Last edited: Sep 3, 2016
  12. Lowbank

    Lowbank Active Member

    Joined:
    Jan 8, 2016
    Posts:
    317
    Likes Received:
    44
    Location:
    Burnley, lancashire
    This is very very interesting..
    Just wish I had understood more when I did a year 1 of an engineering degree..
    well done with the work so far.
     
  13. Alibro

    Alibro Well-Known Member Full Member

    Joined:
    Jan 5, 2015
    Posts:
    6,080
    Likes Received:
    1,885
    Location:
    Northern Ireland
    Brilliant Joe, I'm still bashing, welding and grinding at the minute (the car that is you dirty old man) but as soon as I get her on the road I'll be doing this and working with you as best I can. This car is not a daily driver and was bought to be a toy for me to play with so I am in a better position than most to experiment with it. I've been a computer engineer for 27 years working on everything from high end servers and SAN's to personal PC's, printers and everything in between so I have a basic understanding of electronics but never got into programming so this will be a big learning curve for me but something I'm looking forward to.
     
  14. Joe_H

    Joe_H Well-Known Member

    Joined:
    Dec 30, 2015
    Posts:
    1,486
    Likes Received:
    252
    Location:
    Brit in Northern Portugal
    Just a note to stress something that may have been misleading !!
    YOU DO NOT require ANY expensive multi-meters or ANY expensive test equipment to do this ! - I am only using then to measure the initial accuracy (that is what I was showing. ! - after that - you DO NOT need them - you do not need anything expensive or mega accurate.

    Sorry if the previous post was misleading ! :(
     
  15. Wesoly_Dzik

    Wesoly_Dzik New Member

    Joined:
    Jan 18, 2022
    Posts:
    3
    Likes Received:
    2
    Location:
    Gdańsk
    Hi Joe, Im trying to build MAFAM based on your description. The chip I am using is OPA340A. I am testing the circut with supply voltage from two AA batteries (~2.7V). The positive is connected to pin #3 and the negative is connected (through a resistor) to pin #2. The problem I'm having is output voltage (measured between pin #7 and negative voltage input) is always smaller than the input voltage. I am not sure what am I doing wrong. I would be grateful for any advice.

    EDIT:
    I have figured that my problem was due to missing 5V connected to pins #4 and #7. All is good now!
     

    Attached Files:

    Last edited: Jan 19, 2022
  16. Nodge68

    Nodge68 Well-Known Member

    Joined:
    Nov 15, 2011
    Posts:
    27,154
    Likes Received:
    7,528
    Location:
    Near Newquay
    Joe was banned from this forum some years ago now.
     
  17. guineafowl21

    guineafowl21 Well-Known Member

    Joined:
    Feb 24, 2015
    Posts:
    2,972
    Likes Received:
    2,143
    Location:
    Inverness
    What happened? We were having an interesting pm discussion about an electric fence energiser I was making, then he just dropped off the radar. Nice chap, I thought.
     
  18. GrumpyGel

    GrumpyGel Well-Known Member

    Joined:
    Oct 31, 2013
    Posts:
    21,022
    Likes Received:
    15,485
    Location:
    Christchurch, New Zealand
    He could have been a really good member. I was in exchanges with him on a few threads that started out really good. He was a clever chap - although probably not as clever as he thought he was. He just took things to far and would attack people. He was far to 'confident in his assumptions and beliefs' and became quite an arse hole.
     
    Alibro likes this.
  19. Nodge68

    Nodge68 Well-Known Member

    Joined:
    Nov 15, 2011
    Posts:
    27,154
    Likes Received:
    7,528
    Location:
    Near Newquay
    I had many conversations with him. I reckon he had some form of mental illness.

    He came across as being really clever, however he was really good at finding information on line, then posting it as his own.

    I discovered this by accident, when he quoted something to me in a PM as his own, but it was actually something I'd said years earlier on another forum, so I called him up on it, and he became very aggressive towards me. So I blocked him as he was sending me aggressive PMs after that.

    He was a complete arse hole.
    Another forum member suffered really badly from his outbursts.

    He was much the same on other forums too, mostly ending up in being banned from them too.

    I did wonder if he'd snuck back in a couple of years after he was banned, with a different user name and IP address, but I can't remember what made me suspicious now. :confused:
     
  20. guineafowl21

    guineafowl21 Well-Known Member

    Joined:
    Feb 24, 2015
    Posts:
    2,972
    Likes Received:
    2,143
    Location:
    Inverness
    Well, you think you know someone... Seemed alright to me, but then we never really crossed swords, other than early on when I had a hard job convincing him about something to do with a handbrake fault.
     
< Previous Thread | Next Thread >