ACS714 code for Photon

I’m using the 30amp version of the 714 with 24v DC power (from regulated 10 amp power supplies) to reversible motors. I want to be able to detect whether the motors are running or idle. I currently have 5 systems. I do not get consistent raw analog readings. The “idle” raw number should be around 2048 (4096/2?) but I get numbers between 1980 and 2030. There is always a difference between load/no-load but the gap is only about 14, e.g.: off=2000, running=2014. Software I’ve found on the web has been no help. Any advice?

@rch, can you provide a bit more detail? How are the 714’s wired (schematic). Since the current is reversible, you should have the outputs biased at mid-point of the analog range or 3.3v/2. Since these are 5v parts, you will need to scale the output with a voltage divider.

Is there a 10A version of the current sensor? That Would give you less noise possibly.

Also can’t you just create a code so the 14 counts is ignored and considered idle and not moving?

My application is explained briefly at “”, post 56. For the moment I’m installing 5 systems. The motors I’m using are “KANKIT ® ERU-A2(B2) ELECTRIC ROLL-UP UNIT” rated as 24vdc, 100w, 3rpm. The Photon controls 2 motors thru a 4-relay switch (to switch the +24v between the 2 wires from each motor. The 24vdc power supplies are rated for up to 240 watts. They look identical. Each has a set screw to adjust output DC. I have them adjusted to within .1 watt. I am using ACS714s mounted on Pololu circuit boards. The + output from the PS is connected through the 714s following the printed arrow. The PS +/- power the switch. The 3 connections from the Pololus go to Photon +3.3, GND and A0 (the nearly 5v from the VSS pin seemed to make no real difference). I’ve been using the raw output values to determine when the motors are running or when the builtin limit switches have turned them off. Control of each system is from a smartphone-designed web page. I can control the motors by just giving them lots of time to complete their slow rotation, but the different hoop houses make the max. time nearly 4 minutes. I spent $12/system to get feedback from the motors. Frustrating, so far. There are 2 tiny holes on the Pololu boards where I suspect I could mount a capacitor. But how big? What direction? And would it solve my problem?

So are the motors just going up and down a vertical wall of plastic or over the top as pictured below:

This shouldn’t be to hard to get working how you want it.

Based on what I read it sounds like you just need to filter out the current reading noise when the motors are idle or not moving.

Can you share your Photon code so others can try to help out?

I also think there are a few different ways to accomplish your goal depending on if you’re just going up and down or in an arc like in the picture.

If it were me I would want to know the position of the motor so I know the exactly how open or closed the windows are. You could then adjust how much you open the windows based on how large the temp difference is between your target and inside the tent.

1 Like

They sell oodles of these motors in China (only place they make them, I think). As far as I’ve been able to tell, the only controls they offer are:

3-position switch: UP/OFF/DOWN
temp. sensor control (not easy to be accurate, placement of sensor, gap between up temp & down temp, wind, etc.)

So, my adding the ACS could be a plus. My blog page shows the info/control I can provide.

I’ve found no motors that provide builtin feedback. Setup instructions are in transliterated Chinese.

My motor setup rolls up from the ground riding on a guide pipe.

My Photon program is over 400 lines of C++. Here’s relevant pseudo code:

int readN(int ct) // reads the ACS ct times & returns raw analog average

runMotor(int whichMotor, int direction, int maxSeconds) {
   // start the motor 
   for( using millis() loop till maxSeconds OR... ) {
     rd = readN(3)
     if(rd > MotorJammed) // stop motor, send text, etc
     if(rd <= MaxIdleReading) // return (assuming I can detect idle)