Thank you to the guys at HEGE supporting Badcaps [ HEGE ] [ HEGE DEX Chart ]

Announcement

Collapse
No announcement yet.

Arduino current sensing (in car)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Arduino current sensing (in car)

    Good day folks. Some of you may know that a while back I was avidly trying to install an automatic roll-up system for the windows in my car and many of you were kind enough to provide lots of input on that, helping me learn a lot of stuff. I dropped it for a while due to various reasons, but now I'm back on it after I've been having more and more issues with the current install.

    The car didn't come with such a feature, so a while back I bought an aftermarket box gizmo...thing which sort-of does the job, that is, when you lock the car this box rolls up the windows, but it's pretty "dumb" because it doesn't know whether or not the window has actually closed or is already closed. It just closes a relay for a set number of seconds and "hopes" the window makes it all the way up...which is fine for the most part, except for two instances: if the window is already up, there's no limit switch or current sensing to tell the box to stop cranking, putting quite some load on the battery and motor, since the motor is essentially seized at that point. Also, since it's based on a timer, if there's a smudge on the window or for some reason the rubbers become sticky and the window doesn't make it all the way up in time, the box doesn't know that either and it just stops, which is probably the biggest issue. Sometimes I forget or don't realize I have my window down, so I lock the car and walk away without looking back, only to come back to it later and discover the window is half-way down and rain or bird c*ap had got in....not to mention someone might get in and swipe the radio or something...you get the point.

    So I decided to do something about it by implementing a feature that ensures the windows close properly each time and scrap that box I currently have on there entirely. At first I thought about using switches and installing those in the doors in such way that when the window is all the way up it would activate it and stop whatever device is cranking them. This idea stuck with me for quite some time until I thought about the probability of failure in mechanical switches and also about drilling holes in the chassis which would eventually lead to rust, so I dropped it.

    The idea proposed in my original post involves current-sensing the motors and detecting the spike that should occur when the window has reached the top (and perhaps bottom as well if I REALLY want to be thorough). I struggled with discrete components, which although MAY save some money in the long run, they also introduce a lot of variables and things that can go wrong, so I thought about using a micro....after all, I assume modern cars do this by default and use some sort of micro there, so why not. I have an arduino mini lying around so let's put it to good use.

    Now: current sensing with arduino...in a car. Can it be done ? I'm fully aware that everything must be stepped-down to 5v, since cars run at 12-14v, but admitting we get over that....The idea is to have the arduino "listen" for the lock signal on a pin and once it receives that, roll up the window until it detects a certain current level which would correspond to the motor being seized when the window has reached its end of travel. To overcome false-triggering caused by motor inrush, I'm thinking of a "debounce" feature that only stops the window when a current higher than X amps is maintained for 1s or so (to ensure the window has DEFINITELY reached the top-most position and also act as a safety feature to cut out if a foreign object or a person's limb is inserted in the door frame)...the real challenge here is the current sensing. Once I get that out of the way, the possibilities are virtually endless.

    I came across this article which is fairly close to what I'm trying to achieve. Sounds simple enough: shunt on wire going to the motor, amplify its "output" and send that to the arduino. Then it's a matter of messing with the code to tell it when to start and when to stop. What do you guys think ? Cheers and thanks.
    Wattevah...

    #2
    Re: Arduino current sensing (in car)

    Interesting project. Look forward to seeing your progress. You can monitor current with the arduino by using a shunt, or a hall effect sensor. I prefer the hall effect sensor approach myself.

    A few years ago, I made an electric scooter out of an old bicycle and a motor off of a battery powered lawn mower. I purchased one of those cheap volt/amp meters off ebay, but the amp meter (shunt method) never worked properly. I emailed back and forth with the company, but never could get it to work. So I decided that I would make my own volt/amp meter using an Arduino. It worked great.

    The part that you would be interested in is the hall effect sensor. I drilled a hole in bottle cap, and encased the hall sensor in hot melt glue inside the cap. This left a hollow for the wire that you are monitoring to go through. Once you get everything wired up, you will have to do some calibrating on the arduino, so you'll need a parallel current measurement to guide you. I used 7 segment displays with shift registers, but you probably don't need those.

    It's been a while since I worked on the circuit or the code, but if you decide to go the hall sensor route, I'll attempt to help where possible.
    Attached Files

    Comment


      #3
      Re: Arduino current sensing (in car)

      Interesting. You made that hall sensor yourself ? If so, I'd like some guidelines to make my own. I'd require 2 (one for each window). I expect the current to be somewhere around 30A at full load (at least that's what the fuses in the fusebox for the windows are rated at). It's non-intrusive, so it doesn't cause any voltage drop on the motors, plus you don't have to cut anything....well yeah, technically you HAVE to cut the wire to pass it through, but I'm lucky enough to have spade connectors on those rocker switches, so I can pass the wire through without any chopping. Also no, I don't require any displays or indicators - those would just drain the battery, so it also has to be made as energy-conservative as possible. I'm thinking of somehow making the arduino shut itself down after the car's been fully locked and the windows are rolled up....don't want to wake up to a flat battery one morning....
      Last edited by Dannyx; 02-25-2018, 01:11 PM. Reason: Added details
      Wattevah...

      Comment


        #4
        Re: Arduino current sensing (in car)

        Also found THIS, which sounds promising and suitable for our project here.
        Wattevah...

        Comment


          #5
          Re: Arduino current sensing (in car)

          The one that I made was good up to 100A. You first need to order 2 sensors and find (or order) 2 ferrite cores. I usually pull the cores off of old pcbs. They'll have copper wire wound around them. Try to find cores with inside diameters as close as possible to the size of the wire that you will be monitoring.

          I'm attaching a pic and another datasheet. In the pic, you will see that I drew some pencil lines on the core. You will have to use a dremel tool to cut a slot in the core for the sensor. You want the slot to be narrow enough, so that you almost have to force the sensor into the gap, a tight fit. I would not encase the sensor and core until you do some testing with the arduino. As current flows, the v-out pin of the sensor will send a voltage to the arduino. You calibrate with your code until you have an accurate current measurement. Then, in your case, you code for turning on and off relays that run your motors.
          Attached Files

          Comment


            #6
            Re: Arduino current sensing (in car)

            you could just use a resistive divider to drop 12v down to 3v and then monitor the voltage at the motor with an arduino.

            Comment


              #7
              Re: Arduino current sensing (in car)

              Originally posted by stj View Post
              you could just use a resistive divider to drop 12v down to 3v and then monitor the voltage at the motor with an arduino.
              No need to monitor the voltage, if we're talking about MY scenario. Will could probably benefit from this though.
              Wattevah...

              Comment


                #8
                Re: Arduino current sensing (in car)

                For the volt meter, I did use a divider.

                Comment


                  #9
                  Re: Arduino current sensing (in car)

                  Take a look at this item from Allegra Mirco .com

                  I have use these before and they are easy to use with a micro controller

                  It output is 0 to 5 volts depending on amperage 0 to 50 amp

                  ACS758LCB-050U-PFF-T
                  https://www.digikey.com/product-deta...353-ND/2415198

                  Here is the data sheet for this device

                  https://www.allegromicro.com/~/media...Datasheet.ashx
                  Last edited by sam_sam_sam; 02-25-2018, 07:14 PM.
                  9 PC LCD Monitor
                  6 LCD Flat Screen TV
                  30 Desk Top Switching Power Supply
                  10 Battery Charger Switching Power Supply for Power Tool
                  6 18v Lithium Battery Power Boards for Tool Battery Packs
                  1 XBox 360 Switching Power Supply and M Board
                  25 Servo Drives 220/460 3 Phase
                  6 De-soldering Station Switching Power Supply 1 Power Supply
                  1 Dell Mother Board
                  15 Computer Power Supply
                  1 HP Printer Supply & Control Board * lighting finished it *


                  These two repairs where found with a ESR meter...> Temp at 50*F then at 90*F the ESR reading more than 10%

                  1 Over Head Crane Current Sensing Board ( VFD Failure Five Years Later )
                  2 Hem Saw Computer Stack Board

                  All of these had CAPs POOF
                  All of the mosfet that are taken out by bad caps

                  Comment


                    #10
                    Re: Arduino current sensing (in car)

                    It's similar to the one I suggested I reckon.
                    Will first need to take an actual measurement of the current there to see what I'm working with. I don't have a clamp meter sadly...that would come in really handy. I've been meaning to get one for some time now but never actually got around to it and I certainly don't want to get a piece of junk either just for the sake of it. Been looking at one of those Uni-T's...
                    Wattevah...

                    Comment


                      #11
                      Re: Arduino current sensing (in car)

                      UT210E is really nice - i love mine (now i hacked it!)

                      Comment


                        #12
                        Re: Arduino current sensing (in car)

                        That's the one I want to get also. What'd you hack it to do ?
                        Wattevah...

                        Comment


                          #13
                          Re: Arduino current sensing (in car)

                          10,000 count and all ranges start in DC mode,
                          + NCV with numeric readout (in mv range)

                          oh yea, and because it's 10,000 count instead of 2000 all current ranges roll at 9999 so the maximum is theoretically 1KA !! although tests by others have shown accuracy starts to drift after about 350A

                          oh yes, and it doesnt turn off until i want it too - and that includes the damned backlight.

                          use ENELOOP or LADDA (Ikea brand) NiMh battery's in it.
                          modern shit alkalines seem to just love fucking decent multimeters!!!!!
                          i think it's the ultra-low current draw causing it.
                          Last edited by stj; 02-26-2018, 07:55 AM.

                          Comment


                            #14
                            Re: Arduino current sensing (in car)

                            Ok, question is HOW you managed to hack it ?
                            Wattevah...

                            Comment


                              #15
                              Re: Arduino current sensing (in car)

                              it has an 8pin eeprom (24c02) that holds the configuration and calibration data.

                              not my foto btw.
                              Attached Files

                              Comment


                                #16
                                Re: Arduino current sensing (in car)

                                I see, so there IS a tutorial out there somewhere...good to know. Now back to the matter at hand
                                Wattevah...

                                Comment


                                  #17
                                  Re: Arduino current sensing (in car)

                                  tutorial??
                                  there is a huge thread at EEVblog

                                  Comment


                                    #18
                                    Re: Arduino current sensing (in car)

                                    Started working on the code for the gizmo. We'll just take baby steps here, so the first thing I did was define 3 pins: one for the lock signal, one for the relay that actually drives the windows and another one for detecting the ignition being switched on, because you don't want the thing to run when the car is on and there's someone inside. No current sensing feature for now - just the basics. I haven't got any of those ICs yet, so I'm not 100% sure how I'll implement them. Another issue is going to be calibrating the thing. A potentiometer for setting the current threshold will be required....I learn as I go here, bare with me
                                    Wattevah...

                                    Comment


                                      #19
                                      Re: Arduino current sensing (in car)

                                      Originally posted by Dannyx View Post
                                      Another issue is going to be calibrating the thing. A potentiometer for setting the current threshold will be required....I learn as I go here, bare with me
                                      I wouldn't add unnecessary components. Calibrate in your code. Whatever sensor you use, the arduino pin monitoring the current will see an increase of "x" millivolts for every amp of current flow (I believe mine was 8mV/A). Use your code to set the cut-off point.

                                      Comment


                                        #20
                                        Re: Arduino current sensing (in car)

                                        I'm thinking of making the threshold adjustable both for functional and convenience reasons: the load of the motors may vary with outside temperature, battery level, mechanical factors and so on, so I'd say it's a good idea to have such a feature.

                                        Second, in my case at least, it's not too convenient to have just one setting with no quick way to adjust, since I don't have a garage to do all this stuff in - I have to do everything out in the parking lot, so I need to make the thing as "plug and play" as possible, so ideally I'd have it all working on the bench, then install it and just tweak the threshold to what I need it to match the motors....if I had a garage no problem: take the car apart bit by bit and prototype with the actual motors all day long, but I don't have one sadly, so I don't even have electricity to plug in my laptop to quickly diagnose if need-be. Yeah I know there's inverters and car chargers and stuff, but there's no need to invest in all that stuff for one-time use only, is it ?
                                        Wattevah...

                                        Comment

                                        Working...
                                        X