Recent Posts

Pages: [1] 2 3 ... 10
1
Code: [Select]
  rpmAverage = countRpm/currentTime;
currentTime contains the number of milliseconds that the Arduino has been running. That hardly seems like the proper thing to divide by.

You are counting pulses from the hall effect sensor in some period of time (defined by sampleTime). Dividing the number of pulses by the interval over which the pulses were counted will give you a value that is a ratio of wind speed. The number of pulses per revolution needs to be known to give the actual wind speed. That and some formula that the device maker provides that relates revolutions to wind speed.

The average wind speed needs to take into account the total of all wind speed values in some period of time. You aren't keeping track of anything but the most recent value. You need to keep a running sum and to keep track of how many values make up that sum, so you can compute the average.
2
PLAN / USE CASE:

I'm planning to build a 360° turntable with a Nema17 step motor, that is controlled by an arduino uno r3, A4988 step motor driver and is supplied with a 12V 2A external wall adapter. (arduino is powered separately via usb or onboard dc power socket)
 
I'm not planning to run the stepper motor at "high" speeds, since I want to film and photograph objects that are rotating fairly slowly (around 6 to 10rpm). When taking photographs, the stepper motor will be stopped every time I want to take a photo.


Not sure if this is the correct context for this kind of problem. If not, feel free to direct me!


USED PARTS & DATASHEETS:

Disclaimer - I did not build anything yet, because the parts have yet to arrive.




POTENTIAL SETUP: I oriented myself on this source


QUESTIONS: (I am assuming that I did a lot of things wrong, because I'm really new to this!)

 
1. Power supply:

  • Will the power supply be sufficient enough to run the A4988 and the Nema17?
  • if not, what would you recommend and how did you calculate it?

2. Step motor:
  • Is it correct, that the step motor has a holding torque of around 3,67kg-cm?
  • Are the rated voltage and rated current really "only" 2,4V and 1,3A? And should I power it with a 12V power supply?
  • Do I need anything else, if I want to run the motor at low speeds or does it support that, in combination with the driver,  from the start?

3. Step motor driver:
  • Do you have experience with this particular step driver?
  • Are there other drivers, that would be better suited for my goal?

Are there any other things that I really should pay attention too, if shopping for other parts or while building the circuit? - don't want to fry everything with the first try :D

 
EDIT:
In another forum I got the question, why I want to build the "system" from scratch and why I couldn't just copy what someone else has already done. - like these guys [LINK]

My answer: I want to learn the dos and don'ts of the hard-/ software I use. I want to be able to calculate the necessary factors myself so I can make changes to the setup when I want, without running into a new information/ knowledge gap every time.



Thank you very much for your help on this, really means a lot!
 
Jobbel
3
Hardware / Re: Problema lettura temperatu...
Last post by XRayFull - Today at 07:10 pm
Si tratta del sensore SD18B20

Code: [Select]

https://www.amazon.it/dp/B01MY9QR49/ref=asc_df_B01MY9QR4950260312/?tag=googshopit-21&creative=23402&creativeASIN=B01MY9QR49&linkCode=df0&hvdev=c&hvnetw=g&hvqmt=


e l'ho collegato secondo questo schema:

Code: [Select]

https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2016/08/normal-mode_bb.png?resize=1024%2C714&ssl=1
4
Software / Re: Come uscire in modo corret...
Last post by gpb01 - Today at 07:09 pm
ANCORA ? ? ?

MA COME DIAVOLO VE LO SI DEVE DIRE CHE VOID E' UN "TIPO" DI RITORNO E QUELLE SONO FUNZIONI ? ? ?

NON HA ALCUN SENSO DIRE "se metto in un void" !!!  >:( >:( >:(

Guglielmo
5
Yeah.. "AT+UART_DEF=9600,8,1,0,0" this command works fine. Had same problem. I bricked the firmware by the command which is given in AT instruction set "AT+UART_DEF=9600,8,1,0,3". I reflashed the firmware and used command "AT+UART_DEF=9600,8,1,0,0". And it worked. Hurray!
6
Your code:  Your function (analogVal*5) ?
The scope picture; axis voltage ?
Does the spike vary with speed?
-----------

Is the task to make Arduino recreate the scope picture ? , Measure max spike voltage? or find RPM?
..i'm confused
7
Megatopic / Re: ABC - Arduino Basic Connec...
Last post by pines - Today at 07:08 pm
cè un problema con le stampe i, i fogli forati si sono attaccati tra di loro . Il problema che debbono ristampare e se l'operazione non era definita nel contratto non sò come finirà la cosa  :(
8
Software / Re: Come uscire in modo corret...
Last post by Puso - Today at 07:07 pm
Forse sto cominciando a capire...corregetemi se sbaglio.

In pratica metto in un void alcune condizioni
ES void pulsante()

Se premo il pulsante restituiscimi 1
Se non lo premo restituiscimi 0


poi la richiamo nel loop o in un altro void
ES void led(pulsante)

digitalWrite(led, pulsante)

Giusto????
9
Thanks.I see your point. I am sure this will work.
But what if I have a very big code, then getting the processor cycle count from asm file might be tedious, so in that case the way I mentioned in this post, will that work ? Or is there any other  easier way ?

10
Thank you for your reply.

Here's the code with the tags included:

Code: [Select]
#include <TimerOne.h>
#include <SPI.h>
#include <SparkFun_MiniGen.h>

int i=0;

volatile float NoteTimes[] = {2,2,2,2};
volatile float note[] ={880, 440, 880, 440};
volatile int noteStatus[]={1,1,1,1};


void playnote(float freq){
   
}

void setup(void)
{
  Timer1.initialize(100000); //1 second
  Timer1.attachInterrupt(updateDSS);
  Serial.begin(9600);
}

void updateDSS(void)
{
 
 do{
   
  if(noteStatus[i]==1){
    playnote(note[i]);   
    i++;   
  }
  else{
    playnote(0);
    i++;
  } 
 }while(NoteTimes[i]==0);

 Timer1.setPeriod(NoteTimes[i]*1E6);


 if(i>((sizeof(NoteTimes)/sizeof(float)))-1){  //if there is nothing else in the array
   noInterrupts();
   playnote(0);
  }   
}

void loop(void)
{
   
}


My issue is that yes, the while loop is "killing" the responsiveness but the interrupt only causes problems for the last value. The first 3 have no issues and do exactly what I wish them to do.
Pages: [1] 2 3 ... 10