Amis-30543: Measuring from SLA-Pin?

I try to measure the Back-EMF value at the SLA-Pin. What i did so far was pulling the SLA-Output to analog input of my arduino. Depending of the given Speed of the steps i really get some values there, but it is hard to measure out a significant waveform. unfortunately i have no oszilloscope, and i am not sure, if the serial monitor is fast enough to show something useful. what i reached so far is a kind of stall-detection, because the values seem lower, when the stepper is stalled.

has anybody made some experiences with this excellent driver? i don’t need a ready made piece of code, but some hints/examples would be great help. i asked pololu on the blog, if they would include a sample in their arduino-library, but they said, this Topic is too special for this library. i am not sure about that, since this back-emf-measuring pin is one of the main killing-features of this driver:-(

Hello.

Just to clarify, our response blog was not that the SLA feature is “too special” for an example; rather it is a complicated feature that depends on many aspects of your particular system (like the current limit, supply voltage, and motor itself), so it is not an easy thing to integrate into the library in a general way. That is not to say that we will never release an example for using it, but we do not have any plans for one right now.

In addition, most of what we know about the SLA output is the information that is available in the datasheet and the “AMIS-30543 application note: how to measure Bemf on the SLA-pin” document that you can find on the Resources tab of the driver’s product page, so we do not have any extra insights to offer.

-Claire

Hi Claire,
Ok, i agree that there are too many open parameters for providing a ready made solution for every case. But a basic example as a starting point is really missing and i cannot fully understand, why you provide this geature of the amis- chip wirh an extra pin on your breakout board and also describe it as a new feature, but dont provide additional support for that feature. Normally all your features are well documented and also prvided with samples. In this case the provided information (in form of your mentioned application note) ends exactly at the point, where my question starts. Wouldn’t you agree if i say, that this feature is useless for the typical pololu customer without any additional information?
Speaking for myself, i am not an engineer, but i am tryinh to find out if this driver is suitable for my future project. At the moment i am not sure wether it will be possible building a rotation counting circuit without an additional encoder. At the moment i cannot afford a programmer who does this testing-job for me, but i thought, you probably have the manpower for doing that, and i am sure, you will sell more of these drivers, if peple see rhat it IS possible…

Hello.

It would of course be nice for us to have a nice example, but unfortunately, we do not have the resources to develop one at this time. As for your question of “why you provide this feature… but don’t provide additional support”, this product is a basic breakout board/carrier for an interesting integrated circuit. Our “providing” of the feature amounts to connecting a pin on the IC to the recommended RC filter and making it accessible; it would defeat the purpose of the carrier board to not let people play with the features of the chip. And of course we are going to mention the features of the chip that might make it unique or interesting.

Separately, I strongly recommend that you get an oscilloscope if you have any expectation of continuing to work with electronics. You can get some amazingly decent ones for under $400 now (e.g. Rigol DS1054Z).

- Jan

Hi jan,

thanks for your reply. So i need to try it myself…

my new attemt was reading the output of the SLA pin as fast as possible and sore the values of a short time period in an array, and then display these values to the serial port. first i thought i had luck, but then i realized, that there are nearly the same values, if the motor is not running, even when the whole driver is NOT powerd. as an example, i measured a kind of sine wave between 5V and 0V, 5-6 times in between a period of a 1/10s, so that would be a “ghost signal” of 50-60Hz on the analog pin. when i cut the line between SLA and analog in, the signal becomes stable. so this signal is somehow influenced by the driver, even if it is unpowered. is it a normal behaviour? when the driver is switched, this sine-wave is unterrupted by some small “gaps” so it is possible, that there is a useful signal on the line, but it is much overlayed by this mentioned sine-wave. what can i do to compensate this?

thanks again!

At this point, you could have problems with your physical connections, you could have problems with your microcontroller program, or you might just be making a mistake in analyzing the data you’re getting from the system. It just doesn’t make sense to be doing this kind of debugging without an oscilloscope. And in general, anything you connect to a line that’s supposed to be high impedance can affect it. Even “unpowered” is not specific enough; for instance, is input voltage specifically fixed to zero volts relative to ground or is it just floating? Do you still have the grounds connected between the boards in this “unpowered” configuration?

- Jan

i still have no oszilloscope, but there ARE onboard methods to sample the desired step signals properly. you just need a few tricks, you can see it in my sketch:

  1. increase the speed of the analog input of your arduino to the fastest possible value
  2. do not write your measured value to the serial port, but put the measured values in an array first, and display them at the end (e.g. after one second in my case) to the serial port.
  3. depending on your motor speed it is useful to change the input sensitivity of the analog input (in my case i choose 2.56V on my arduino Mega)
  4. if you dont have an oszilloscope: put these values in a colume of your excel app or similar program and display it as a graph

feel free to take my code as a starting point.
My setting:
arduinoMega2560, 1.7A stepper motor from pololu

on the attachment you can see to waves for one second. the red one shows, how the values go down, when the motor is stalled.

here is my sketch:

//For a faster reading frequency on the Anoalog In Pins
#define FASTADC 1
// defines for setting and clearing register bits
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif


#include <SPI.h>
#include <AMIS30543.h>

const uint8_t amisDirPin = 2;
const uint8_t amisStepPin = 3;
const uint8_t amisSlaveSelect = 4;

int value[500];//array for storage of the measured values on the analog pin
int i=0;
int toggle=0;
int ms_position;
long int timer_new;
int stop_flag=0;

AMIS30543 stepper;

void setup()
{

 //sbi=1, cbi=0 
#if FASTADC
  // sets the prescaler to smallest possible factor
  cbi(ADCSRA,ADPS2) ;
  cbi(ADCSRA,ADPS1) ;
  cbi(ADCSRA,ADPS0) ;
#endif

  
//analogReference(INTERNAL1V1);
analogReference(INTERNAL2V56);//sets the reference voltage from 5V to 2.56V (arduinoMega)
  Serial.begin(250000) ;

  SPI.begin();
  stepper.init(amisSlaveSelect);

  // Drive the NXT/STEP and DIR pins low initially.
  digitalWrite(amisStepPin, LOW);
  pinMode(amisStepPin, OUTPUT);
  digitalWrite(amisDirPin, LOW);
  pinMode(amisDirPin, OUTPUT);

  // Give the driver some time to power up.
  delay(10);
  // Reset the driver to its default settings.
stepper.resetSettings();

  // Set the current limit.  You should change the number here to
  // an appropriate value for your particular system.
  stepper.setCurrentMilliamps(500);
delay(10);
  // Set the number of microsteps that correspond to one full step.
  stepper.setStepMode(128);
delay(10);

stepper.setPwmFrequencyDouble();

  stepper.enableDriver();
   delay(1000); 
   tone(amisStepPin,24000);//i am using the tone() function for a non-blocking method of getting fast step-signals;-)
 
}

void loop()
{


long int timer = millis();
while (stop_flag == 0){
while (timer_new - timer < 1000)
{

ms_position= stepper.readPosition();//reads the microstep position

if(ms_position % 128 != 0 && toggle ==1){//if there is a full step...
  toggle=0;
}

if(ms_position % 128 == 0 &&  toggle==0){

toggle=1;
delayMicroseconds(50);
    value[i]= analogRead(A0);
    i++;
}
  timer_new = millis();
}

stop_flag=1;
i=0;
 
for (i=0;i<500;i++)
{
  Serial.println(value[i]);
}



delay(1000);
}

}





Hello! I know this is a very old topic but I managed to get my self in a project that involves the AMIS 30543, it happens that I need to need to detect a stall so I can stop the stepper motor when a cartridge of beads is full (the steeper is in charge of pushing them), I’m not using optical nor hall sensors since is a system where I cannot work with them, at least is not the first option. Well, I haven’t been able to make it work, I’ve followed the documentation, and I’ve made it work a couple of times but it is not consistent, has someone found a good and tested application for this?