Arduino Controlled Auto Start Generator. (Off Grid Living.)

Didn't know where else to put this post, Mods feel free to move it to the right catagory. :slight_smile: thanks!

I began a few weeks ago with a 1998 Geo metro....

Now i have the beginnings of a generator. I plan to use Arduino to control the overall function of the generator as well as make the generator smart and IOT/Bluetooth Controlled.

Obviously I plan on using a mega and some other fun bits, but i need a place to store all the information i am creating / researching, so i figure if im going to have the information myself, i may as well share it with the rest of the world. Since this project uses Real and dangerous concepts/ objects/ knowledge, if you aren't aware of what it does, i dont advise you try something like this as well as dont hold me responsible when you drop a battery on your metal fuel tank and blow yourself away... JS

10 seconds of background on me, I am an ASE Master Technitian, I am Certified by 5 Major Dealers to work on their brand of goodness as well as Hybrid certified. I have an associates Degree in Automotive Systems Diagnostics, A bachelors in Mechanical engineering, and am working towards a Bachelors in Electrical engineering, Pretty much if it has electricity in it or serves some human purpose, i can mod/tinker/destroy/fix it. Given this, my care of grammar is very low, use of English is also not a concern of mine. Please do not troll this post, If you are not interested I understand and thank you for looking. I have spent the last two years of my life building Commercial grade Solar Power plants, I also live domestically off the grid ( I am my own water, sewage and electric company)

now for a cool movie....

i would embed it but yeah the forum just isnt cool like that :frowning:

that movie shows what i have so far. I have removed the engine from the car, disassembled the manual transmission, split the case of the trans mission, cut the rest of the input shaft off of the primary gears, reassembled the clutch onto the engine, used the front half of the transmission often referred to as the bell housing, the input bearing, a pulley hub and the biggest pulley i could buy from Tractor supply. i welded the pulley to the hub and used a shop press to force the input shaft from the original transmission into the pulley hub, secured this witht the two grub screws that come on the collar. then using an old broken trundle bed (like this one :: https://images-na.ssl-images-amazon.com/images/I/41K0FE7KtlL._AC_US200_.jpg ) i cut free all of the angle iron and welded a frame. to this frame i cut apart a construction speed limit sign post from one of my job sites into pieces which originally were to serve as a slid-able belt tensioner, since sign post are normally full of evenly spaced holes. however the way the engine sits on the frame the big pulley wasnt far enough forward to work correctly so i drilled 2 holes in a piece of spare angle iron and welded a harbor freight 12mm 1/4" drive socket to the angle iron, over the socket i slif the tensioner pulley from a 2000 s10 which fits nice and snug. when the two holes have bolts in them they pick up all the slack in the drive belt.

the drive belt drives a jack shaft fitted with the smallest pulley i could find at Tractor supply, affixed to a 8" section of 3/4" rod that runs through 2 self centering pillow block bearings and into a GM power steering pump ulley for a 1998 Chevrolet K1500, this pulley being approx. 3 to 4 times bigger than a standard Alternator pulley will be the pulley that will eventually drive 8, 150A GM 1 wire alternators. Giving me roughly 1200A @12VDC at full wide open regulation. or roughly 14KwDC theoretical. probably be more like 12KwDC none the less i only use at max 2500wDC including my server tv and current living accomodations, however this is to be the power plant for my new home so bigger is always better.

the pulley system produces a measured 8400 rpm at the alternator drive pulley, while at idle at a little over 900rpm. standard car alternators have a maximum rotational speed of 20KRPM there for i am desiging this system to spool the alternators at 90% of their max. this will allow me to use much smaller pulse width to the rotors of the alternators and generate far larger electrical Fields in the stators. my plan is also to idle the motor down to around 500rpm to conserve on fuel. also since the pulley is much larger than the flywheel on the engine it adds rotating mass to the crank allowing me to use a smaller rpm range and still maintain a running engine...

i have reused everything from the car, the fuel tank, sender, engine, fuel lines, all sensors , harness and the stock ecm. was gonna do a speed duino but all i really need to do is monitor the engine the GM guys were paid enough already to figure out how to make it run well. why mess with that?

i have 3d printed relay blocks to hold car relays so all of the electronics are native, i also 3d printed the fuse block, and i have deleted most of the emission controls to the engine as they sacrifice engine longevity and power in the name of reduced greenhouse gases, at the rate we are going in this world we are gonna kill each other before we suffocate... js.

Now to the arduino end of things.

this is my current map of pins i will pull from the stock ecm via splicing the original harness indo the arduino. the arduino will have most of its native adc pins used monitoring the engine vitals. 2 additional i2C ADCs will be attached to monitor the output from the generators. other hardware will include a real time clock and calendar, w5100 ethernet connection, bluetooth, 3.5" touch panel display, and IR tach sensors on each of the alternators, crank and jackshaft. if you have any ideas as to what i could also add i am open to suggestion. Later in the project i will also be adding more control circuitry to control the air conditioning and heat as well as the hot water heater via fluid to fluid heat exchanger.

Map Of ECM Harness:
Digital Inputs
Generatror MIL (9x)
PCM MIL c1-17 PPL/YEL
IG SW Pos. On Custom
IG SW Pos. ACC Custom
IG SW Pos. Start Custom
TP Closed Switch Custom
UpShift MIL c1-18 PPL/RED
EFE On Signal c2-12 WHT/BLK
Dwell FeedBack (Tach Sig) c1-23 BRN (12V?)
Commanded Dwell c1-10 ORN (5v?)

Specialized
ETach IR SENSOR
JTach " "
Atach (8x) " "

Outputs
Starter Relay Custom
Main Power Relay Custom
Throttle Servo Custom
Electrical Load Idle Up c3-18 BRN/YEL
A/C Load Idle Up c3-19 BLU/RED

Analog Inputs
Fuel Level c3-10 YEL/RED (?Deleted?)
Gen Battery Level Alt. Pin 2 (Pull Up resistor on ARD.)
Upstream 02 Sensor c2-13 RED
Downstream 02 Sensor c3-08 YEL
MAP Sensor c2-05 LT-GRN/RED
TPS c2-06 LT-GRN/WHT
ECT c2-07 GRY/WHT
IAT c2-14 GRY
Fuel Tank Pressure S. c3-21 LT GRN/YEL

sometime in the next few days i will add some pictures of it in the day light. as well as some harness diagrams... a picture is worth a thousand words.

til then
-T

ok some pictures of what i have ...

ok this forum image tag is also very weak wont share from google drive or drop box.. hurts my feelings hang on while i see where else i can share from ...

this is a side view of the pulley drive.. kinda giving you an overview.

this shows how i used the stock clutch and bell housing.

this is the stock fuel tank

it is a suzuki G10 engine...

993 cubic centimeters

lots of pics. should have more when my 6 megas get here... i got 6 of them for 32$ about 10 mins ago... sweet deal .

no attach.jpg

sorry bob, like i say i was working on the "which website will arduino use" dilemma

ECM pinouts

ecmc1.pdf (51.9 KB)

ecmc2.pdf (38.2 KB)

ecmc4.pdf (34.9 KB)

all wiring diagrams

chargin.pdf (52.5 KB)

cluster1.pdf (109 KB)

cluster2.pdf (74.5 KB)

cluster3.pdf (54.3 KB)

dlc.pdf (67.1 KB)

dlc2.pdf (50.2 KB)

ecm power diagram.pdf (66.1 KB)

emissions.pdf (63.7 KB)

fan.pdf (48.9 KB)

fueling.pdf (67.7 KB)

fuelsens.pdf (17.8 KB)

idlespeedcontrol.pdf (54 KB)

idle up signals.pdf (66 KB)

ignitiandiagram.pdf (63.5 KB)

map.pdf (27.4 KB)

sense1.pdf (71 KB)

sense2.pdf (60.9 KB)

sense3.pdf (45.4 KB)

startig.pdf (56.5 KB)

Am honestly amazed at how much work you are putting in !

WAAAY above anything I have attempted and your dedication to detail will stand you in good stead...

just a quick update:

i ordered some parts today to may the interface to the arduino, i bought a mega screw terminal board for 10$ and some dupont patches i figure if i cut the patches in half and use the male end i can solder it where the screw terminals go and i will be able to remove the arduino for programming since the engine is a bit away from my computer. i still have to figure out the interface for the OBDII connector but in a week or so i shoudl have a working interface to read the live sensors..

havent been able to get to the junk yard yet to get the alternators need to find a ride sometime this week and get that done. still also waiting on the megas in the mail.

android app

math for pulley drive.

incoherent probably from your end but pretty easy to figure out ...

main pulley circ 34.5575191895" or 2.87979326579'
3455.75191895 feet per minute at 1200 rpm
207345.115137 feet per hour
39.2699081699 MPH at engine.

6.66666666667 from drive to driven ratio

261.7993878 MPH at driven

PS pulley circ = 18.0641577581" or 1.50534647984'
PS Pulley feet per minute 12042.7718387 @engine 1200/jack 8000
PS Pulley feet per hour 722566.310324
PS Pulley MPH 136.849679986

Alt pulley circ. 7.53982236862"

ratio 2.39583333333

alternator MPH = 327.869024966 MPH

output RPM = 1200 * 6.66666666667 * 2.39583333333 is 19166.6666666 rpm
ratio 1:15.9722222222

This video is before idle adjustment, which is how i received the engine when i pulled it out of the car the idel was way up for some reason.

after idle adjustment we were able to get some pretty accurate photo tachometer readings

with this information i have a crank to driven ratio in real life of ...

Idle : 851.2 rpm
Micro V idle :4113 prm

ratio from crank to micro V is 4.8320018797:1 which is much better than i expected. given that there is a theoretcial Micro V to alternator increase again by 4. which would put me right on point for a 16,000 rpm sweet spot.

Sometime later this week a man is supposed to be giving me a crate of alternators (FOR FREE... the kindness of people in this world) i should have a pretty great and close to done drive mock up by then and we can see what the actual numbers are. I did try to hold a microV belt on the out pully and to an alternator with out losing a finger, the results are pretty stunnign for the whole second or 2 the belt was on it was able to spool the alternator enough that it took about 10 seconds to wind down.

the android app development part of things is going very well, using ai2 instead of android studio at the momnent becasue of my job and i only have a few hours every night to donate to this massive project. i have decided to go full bluetooth, and remove the touch screen from the arduino side of things.

here are some app screenshots.














in most cars you would never want to see a Malfunction indicator lamp or mil, or as they are so lovingly called "idiot lights" but as i was putting together the graphic to be incorporated in the app to accommodate the already obvious idiot lights such as the check engine lamp i realized that a MIL in programming could be a good quick way to get information about an object vs having to decipher a graph or a gauge. so now all of my idiot lights are 4 and 5 stage idiot lights showing either off bad warning good, or in the case of the temp sensors cold. i figured this would help the app be better and quicker informative to the situations at hand.

as far as ai2 goes i couldn't find a graphing example that was in English so i mettled my way through a Spanish one and when that came down to be no help at all i decided to take a crack at it... this half of the code would be super useful for any one who has a blue-tooth enabled data collection arduino as my code in the end will have data mappable color changeable live information charts. my app consists of 16 charts currently that you can choose what data is mapped to which graph and what color the line is. also much like a live dso you can change the time base to view data over a long or short period of time with a relatively good refresh rate of 10ms. its not a dso but it does give you a graphical idea of what goes on ... which can be useful. eventually i would like it to update with serial information sends giving much better resolution . i also am going to add a feature to where the images are saved of the graphs as the graph gets full allowing you to stitch them back together with panoramic software so you can get a full picture of what happened over a certain amount of time .

when it is done i will post the image of the code blocks for that portion of the code or i may just put that portion in its own project and release it on google play ... i havent decided yet.

-Till next time

-T

ugh, china post... what can i say ...

well after a few weeks my mail box has begun to fill with presents.

this is a picture of what i am now calling my protostack.




this below image contains a bit of luck, i had not originally intended to use this relay board it was a left over from a long long forgotten project. the 3d print base mounting that holds all of the voltage dividers actually lined up by coincidence to the relay board mounting holes. I guess some things were just meant to be .. lol


that flyaway of yellow, red and black wire is a MCP23017 i2c port expander. i think i would be pretty close ot out of pins had i not also made it to hook into that board. the down side to this relay board however is that the relays are 12v, and the control circuitry is 5V in the beginning it had been my goal to steer clear of dual power supplies and just be on 5V but i suppose for now because i have it it is a necessary evil.




this is the majority of the stack at this moment .. the board that mounts the arduino is a little messed up due to Slic3r doing something weird and breaking.. so i had to go back to Cura, which seems since they updated it to actually be a lot less buggy and work better. i have about 2 hours left for the arduino mount plate to be finished printing then i will reassemble.



thankfully i have been doing this a long time. not arduino, but robotics/electronics stuff. because without all the pieces laying around that i do have i would be seriously waiting on china a lot. and idk what happened to the old way which was air mail but a lot of chinese sellers seem to be using the slow boat and drop ship a lot more now a days, which slows progress, but the cost is still cheaper and ebay is still faster than wish... i had the relay board , 6 of the voltage dividers and the mega sensor shield laying around (actually i buy the sensor shields in bulk like i do the arduinos.) these sensor shields however where free because they cannot be self powered as there is a short in the pcb, so i ended up getting $60 worth of them for free and i have to patch in the 5v myself. as for new things 20 of the voltage dividers are new the 3d printed plates are new (obviously), the arduino itself is virgin, and the arduino screw terminal board is new. I have never had one of these screw terminal boards but it looks pretty cool and for $10 it better be cool. hopefully no pcb defects. in this set up i can mount a total of 32 voltage dividers even though my current design only calls for 26, also the relay board is a bit over kill as i only need 12 relays, however 2 of the relays on this board are bad any how. so im only surplus 2 relay channels. hopefully by tonight i will have the sdcard holder the w5100 lan module and the bluetooth mounted so i can get some test run with the Android app. ill come back with more pictures.

this is by far the bulkiest proto set up i have had and yet by far it is one of the neatest. the screw terminal board will allow me to directly interface with 5V signals (Map,ECT,IAT,O2S,TPS) while the sensor shield will make quick connections between the voltage dividers and tachometers simple using servo extension cables. I have 1000 dupont wires coming to connect the odds and ins as i didn't want to make a harness for this, because if you have ever done it crimping dupont connectors ,being right handed,with a left hand crimper that hardly ever works is a sort of hit or miss pain in the a$$. connections to the lan, rtc, sd card and bluetooth will also all utilize mutilated dupont wires to attach to the screw terminals.

eventually once all the bugs are worked out and i minimize all the hardware i will send off for a custom pcb. from the looks of it it may end up being a stack of pcbs since they cost a pretty penny if they are big. a word on the voltage dividers before someone eats me up with "ugh what a waste of money for 2 resistors and a terminal block" for one if something where to go wrong i can just swap one out, and for 2 i only gave 5$ for 20 of them so in the end you cant even buy terminal blocks for that. and the other comment "voltage dividers are bad form" well since 15 of those dividers are connected to digital lines just to show me on or off i suppose its really not bad form, it save a bunch of tiem with some over complicated circuit. i bird in the hand is worth 2 in the bush.

the biggest part that is gonna kill me money wise is the 200A bidirectional current sensors for the 10 of them i need the total cost is just under 160$ that will be another layer in the stack and to be honest it may be a few weeks away before i have 160$ to blow. so reasonably that will be one of the last things i put on this system. i am also waiting on 4 additional 4 channel 16bit adcs to measure all of my analog stuff as the onboard adc is saturated with 5 volt signals that are naturally generated by a cars ecu. i may have to come up with some sort of i2c intermediary board to connect the clock, mcp23017, and the 4 adcs, but in the end its just another layer in the stack .

i was hoping to fit it all in a water tight container from work, however after assembling it i have decided i will probably piggy back the entire stack onto the main ecm and then find another container to put it in because the container that i have now is far too shallow, i thought about 3d printing it but i dont think i want the trouble of figuring out the water tight part.

and finally on easter of all days i nuked the ignition module for the engine so now i must also replace that, however since it is original and i exposed it to this southern weather i dont really blame it for blowing up ... i think then i create the next one all in all i am going to leave the engine in the metro and use the passenger compartment for the battery storage and well most things are already water tight in a car...

Be back in a little while

-T

Looks like it a vary comprehensive build...
Are you sure that first belt is going to be up to the job? I realise that the belt speed is quite high but your small pully is very small, too small I expect...

I am not saying it will not work and I cant back up the statement with a calculation but my practical experiance of belt drives makes me very uneasy given the power you are going for.
I think you are going to shred belts very quickly and unless they are impossibly tight, which is not at all efficent, then they will slip and burn, also very inefficent, costly and inconvieniant.

Also Have you considdered an PLG conversion, beyyer for the environment, well slightly, and much cheaper to run, at least it is in the UK.

I am also off grid, apart from a phone line, and in the process of integrating my manual systems.

Dont think I can offer much in the way of help or advice, you seem to have it sorted.

Basically just wanted to say HI and good luck..

I would be interested in your battery arrangement, what you use, what you charge them with and how it is managed and how you estimate state of charge.
Only if you get a few mins, its not urgent, yet

Have fun,
Al

"Looks like it a vary comprehensive build...
Are you sure that first belt is going to be up to the job? I realise that the belt speed is quite high but your small pully is very small, too small I expect...

I am not saying it will not work and I cant back up the statement with a calculation but my practical experiance of belt drives makes me very uneasy given the power you are going for.
I think you are going to shred belts very quickly and unless they are impossibly tight, which is not at all efficent, then they will slip and burn, also very inefficent, costly and inconvieniant."

i have a few movies of it working with no load .. until i build the load side i really cant tell about burning or shredding. what i know about belts from my years in automotive is that sudden adjustments to speed are bad but if you do things gradually belts take a beating and relly a belt a month for me is accepltable becasue in your mony its about a pound fifty for a belt. these also are not automotive belts they are high tinsel pto farm belts. they take a pretty good beating, burrently i am more concerened with the itsy bitsy out of balance i have on the big pully .. also the spaeed of the main belt is only 850rpm.. which for one of these belts is really slow as they are designed to run up to 5000 rpm on a ride on lawn mower. there are some youtube links above that take you to the test videos that show the rps if you are interested.

the driven pulley is too small in what way?

also i may or may not have mentioned that the stock clutch that was in the manual transmission is still intact and still works, i am currently working on a method to engage it electronically .. but thats not a priority for now it will be engaged with the old parking brake lever. being easy on the clutch as if it was an actual car will determine the belt load.also i may have mentioned this but the alternators commutators during initial start up and spool will be turned off (demaganatized.) so there will be just 8 free spinning alternators on the other side of the jack shaft.

"Also Have you considdered an PLG conversion, beyyer for the environment, well slightly, and much cheaper to run, at least it is in the UK."

if PLG is LPG or liquified propane gas, then that is 100000000% out of the question as a US gallon of gas/petrol(fuel[dino juice]) is only $2.12US as of this morning and LPG is 36$ for 5 gallons, plus i would have to make an injector plate. oh yeah and lpg creeps then blows up ... personal opinion as dumb as this sounds stupid but ill take a flash fire over an explosion. in order for petrol to combust it must be near a mixture of 14:1 air fuel ratio... and i can ensure that never happens to my storage tanks, propane clouds and then poof. its always at the perfect ratio, or its at the point of dissipation. plus i think i mentioned its way more exspensive here.

I am also off grid, apart from a phone line, and in the process of integrating my manual systems.

i dont have a phone line.. have a cell though with unlimited highspeed data for 65$ a month... works pretty great where i am. i think i would be at an advantage though becasue i never had manual systems to begin with. this is all new, then im going off grid. when i get the pcbs for this generator control i should have a few extras your welcome to one, and a copy of the code and android app.

Dont think I can offer much in the way of help or advice, you seem to have it sorted.

thats fine i still like to talk to people.. ideas of many are better than the ideas of one.

Basically just wanted to say HI and good luck..

I would be interested in your battery arrangement, what you use, what you charge them with and how it is managed and how you estimate state of charge.

im gonna use the K.I.S.S. model ... which if you dont know stands for "Keep it simple stupid." i have currently designed a battery bank of 16 batterys from diesel semi trucks ... the batteries i have now are used and dont turn over an 18wheeler but they hold good charge. 16 batteries is 4 banks of 4 batteries. the batteries and their management are the function of another arduino which will also control the solar array and the solar tracker. (still about a year out) basically the battery bank will be a matrix on a rotating charging schedule 3 banks online one bank off line. the offline bank charges while the other 3 banks keep systems online. based on the Ah capacity of the batteries you can time the amount of time each bank has to depletion.. the batteries i have are quite large. so... how to make this make sense.

ok

there is a main power bus imagine a copper rod.... hang on ill go draw it and come back ...

it is a theory and i have doen this with smaller batteries, and it may not work here, but the motors represent the alternators they are connected in the real world by 2 200A solenoids the battery banks are similarily connected to 2 200A relays each bank .. also the batteries are connected parralell in reality not series as the image depicts.

ok .

persistant mode is the idea to always have power from somewhere to feed the resistor or the global load which is what the resistor represents. one of the battery relays connects the bank to the load the other relay connects it to the charge system one alternator per bank to simulate a "medium" charge 2 alternators to simulate a "fast charge" the alternator output is switched between a global power rail or charge mode. this ensures that if the generator is running power is going wither directly to the load (which is 3 battery banks(pretty much trickle charge or just as capacitive devices) + the inverters) or directly to one bank in a "charge mode" the global bus can be completely separated from the alternators via a switch gear (because thats all i can find that will take 1200 amps.) seperating the alternators from the bus allows no parasitic back flow and for it to run off complete batteries, which for the inverters im soureing would give me approximately 8 hours of power until i need to find sun or fix the powerplant.

the generator engine itself can be swapped out in a little under 30 minutes. i am already building a back up engine that will be put away in case of permanant failure. because you have to realize is while i have gone in detail in prior posts about the fact that this is one way i get my electricity it is also the primary way for me to get Heated water, heated air, air conditioning, and hydraulic power.

as a secondary i will have electric heaters, both water and air, and 2 1500 watt air conditioners, in the region i live in it snows just as fast as it hits 108 degress at 80% humidity . (its so nasty in the summer time.) last week today it was 90 degrees outside right now its 65 and raining. :frowning:

im sure i missed somethings but that is the general idea .. feel free with more questions becasue the questions you asked were things i had come up with but not really considered yet.

-T

^^^^ Did this joker just spam me on a maker forum?

WOW...

Spam removed & poster banned.

Thanks for that CrossRoads. :slight_smile:

well i spent an hour writing this up a minute ago and one wrong button push and it was gone so here we go again .

today was a good day (except the part where i dumped an hour long report on what i did today :frowning: ) i was able to after 2 days find all the pieces and assemble a mock up to test the code for the tachometers that will be on the GeoRator. The Georator will have a tachometer system that checks the speed of the rotating assemblies at 10 different places. this will allow me to diagnose things like; failing bearings, belt slippage, broken or missing belts, belt drag. as well as show me information such as drive ratios, allow me to calculate overall system efficiency vs fuel consumption, calculate load, and a few more things i have forgot at the moment.

for those of you who dont wanna hear me blabber on for a minute here is the video and you can just cut to the chase :slight_smile:
Video

Due to the system having 10 tachometers, and my limited (intentionally) knowledge of interrupts i took a simpler approach that will allow me to attach a tachometer anywhere in the system. I am personally not even sure that a Mega has 10 user accessable hardware interupts therefore using a interrupt based tachometer system to me was out of my reach . feel free to explain or point to information. but in the past with other things that have had interupts the process of getting them to work has alwasy been a pain in the neck for me and so i stay mainly proceedural.

The Hardware:

FC-51 infrared proximity sensor.

these sensors can be found most every where on the internet for about a dollar but, i get them for about 50 cents each becasue i buy them in bulk. these ones i am using today are actually left overs from the drone project that is on hold (due to sandisk and there catastrophic technology failure... stupid jump drive)

for those of you not familiar with these sensors they have many uses from very simple and primitive range finding, to break sensors or slot sensors (if you use 2 or you do some solder rework) and they make decent photo tachometers. the only problems i have out of them is that the leads on the ir set are very flimsy, at least in all the ones i have ever had. not a problem for me because i have a few dozen of them but it could be a problem for someone else. normally after i break one of the leds off i just rework the remaining circuit into a comparator, which from what i can tell is what it is, works really well for other applications and it is my way of recycling instead of pollution. these sensors are very sensitive when the transmitter is not isolated from the receiver. however when you use a case that isolates the beams they become a lot less responsive. i would assume that this has to do with he lenses on the leds, i would guess they are about 20 degrees or so which allows for the light cone and the detection cone to overlap when they are not in a case. this is great for things like line followers but in the case of a photo tachometer that can lead to false positives which give bad data, old timers know "garbage in, garbage out". to give an example of how sensitive these are, when they are not enclosed they will detect color contrast of a whit piece of paper on almost any back ground, they can detect your fingers passing in front of them as well as most other objects. when they are isolated they will not detect any of that. the only thing they will detect is the beam reflected back at the receiver . for this little trick i used a piece of foil tape that is exactly the same size as the nose end of the enclosure for the sensor.

[continued....]

I find losing a long writeup too easy to do on my laptop. Longer messages I'll compose elsewhere and then paste it in.

i am lucky enough to have a 3D printer, and even more lucky that i have finally fixed it (yet again) this allowed me to use Blender to model an enclosure that would isolate the beams as well as later be able to be filled with an encapsulant that will protect the sensor from dust dirt water oil and general grime of living in the country ... oh yeah and mice and bugs.

all of the above mentioned is good however these sensors offer up yet another snag. on the top side of the sensor is a potentiometer that is used to adjust the sensitivity (or range however you look at it and depending on application) normally if the rang in your project changes there is no problem bust out s crew driver and adjust as needed. Then there is me. I am going to eventually fill the enclosure with a resin that will make adjusting this potentiometer impossible, so electronically there is no way possible to make adjustments later, therefore i 3d printed a bracket to hold the sensor enclosure. the bracket allows the enclosure to slide in and out, then can be locked into place with a 4mm set screw allowing for weather proofing, later readjustment, and when the sensor is receded into the bracket it further narrows the window of light. This is old school common adjustment practice on some cars for the CKP sensor. in the pictures above i am actually holding the sensor in the bracket with a piece of 4mm all-screw that is doubling as a mount point so i could test the set up. below are some renderings of the models for the 3d print.

all of the 3d files can be found here :
Thing

now the code:

#include <Servo.h>

Servo myservo;
int Htime;              //high time
int Ltime;              //low time
float Ttime;            //total time of a cycle
float frequency;        //storing frequency
float RPM;
float RotorDiameter = 0.22966; //2.75591; diameter of object that spins for accurate rpm/mph calculations
const float pi = 3.14159; //explination needed???
float MPH;              //MPH value

void arm() {
  // arm the speed controller, modify as necessary for your ESC
  setSpeed(0);
  delay(1000); //delay 1 second,  some speed controllers may need longer
}

void Measure() {
  Htime = pulseIn(8, HIGH);   //read high time
  Ltime = pulseIn(8, LOW);     //read low time

  Ttime = Htime + Ltime;

  frequency = 1000000 / Ttime; //getting frequency with Ttime is in Micro seconds
  ConvertToRPM();
  ConvertToMPH();
  Serial.print("Sensor Frequency : ");
  Serial.println(frequency);
  Serial.print("RPM : ");
  Serial.println(RPM);
  Serial.print("MPH : ");
  Serial.println(MPH);  
  Serial.println();
  Serial.println("-----------------------------------------------------------------------");
  Serial.println();
}
void ConvertToRPM() {
  RPM = 60 * frequency;
}
void ConvertToMPH() {
  MPH = (RotorDiameter * pi) * (RPM * 60) / 5280;
}
void setSpeed(int speed) {
  // speed is from 0 to 100 where 0 is off and 100 is maximum speed
  //the following maps speed values of 0-100 to angles from 0-180,
  // some speed controllers may need different values, see the ESC instructions
  int angle = map(speed, 0, 100, 0, 180);
  myservo.write(angle);
}

void setup()
{
  Serial.begin(115200);
  pinMode(8, INPUT);
  myservo.attach(9);
  arm();
}


void loop()
{
  int speed;

  // sweep up from 0 to to maximum speed in 20 seconds
  for (speed = 25; speed <= 80; speed += 1) {
    setSpeed(speed);
    delay(100);
    Measure();
  }
    delay(500); // stop the motor for 5 seconds
  // sweep back down to 0 speed.
  for (speed = 80; speed > 25; speed -= 1) {
    setSpeed(speed);
    delay(100);
    Measure();
  }
  setSpeed(2);
  Measure();
  //delay(500); // stop the motor for 5 seconds
}

hopefully in the next few hours i will be able to get this information generated from this small program integrated with the bluetooth module and begin tests of the serial link to the bluetooth app.

well i probably forgot some stuff but that is the bulk of it.. questions comments corrections as always welcome. Til my next 2 hours of free time ...

-T

just a quick update.

the snag from a few days ago where i had a no start condition on the engine i have diagnosed and it would appear that the 5V reference in my ecm is no longer functional thus rendering any of the stock engine sensors non functional .. i am going to try and patch in an external 5v eference today to see if it will work then .. if that is the case i will continue to use the stock ecu id not then i will begin ordering and assembly of a speeduino