Loading...
  Show Posts
Pages: [1] 2 3 4
1  Using Arduino / General Electronics / Re: Opto couplers and relays - please clarify on: April 22, 2013, 12:59:17 am
HI Papu
I have recently used the opto coupler that came in the kit. I did not use the arduino as this was a separate project. I was wanting to change a very low amperage 12v supply to a higher amperage 12v. I used the opto with a 220ohms resistor between the +12v low supply and anode. The cathode to 0v. the higher amperage 12v to the collector. With power on the input side the emitter went high 12v.

So yes you can use an opto instead of a relay.
2  Community / Website and Forum / Re: Inserting serial monitor in the forum on: October 30, 2012, 04:37:30 am
Quote
Actually have been programming since I was 9 years old.
That really doesn't tell us much.
  Does this mean that you remember CP/M? ... Maybe PC-DOS?
  Does this mean that you remember that the eight function keys belong at the left end of the keyboard, opposite the numberpad?


Don
Yes I remember now but have been using Windows for too long now
3  Using Arduino / General Electronics / Re: Hall effect sensors on: October 23, 2012, 02:01:18 am
Hey,
I suggest that you do not use the attach interrupt function at all,try using the pulseIn function,as what you want the is the pulse,whenever the magnetic fields react with the sensor.
What do others think?

Is it possible to add another interrupt function, again RPM but for a slow shaft speed (circa 50 to 100 rpm)?
4  Using Arduino / General Electronics / Re: Hall effect sensors on: October 22, 2012, 01:09:10 am

Can you explain the *4 and the *10 ?    Looking at the code I expected other result (a growing value for smoothrpm).

The out put was a 1/4 of the RPM; example
Code:
rpm 3703   smooth rpm 925
so I added *4, the 10 was to try and get an even more average.
5  Using Arduino / General Electronics / Re: Hall effect sensors on: October 21, 2012, 11:45:45 am
That are quite smooth readings esp compared to the previous ones. You can smooth these readings even more in the loop() e.g. by only adjusting for 25% of the new rpm value;

Code:
loop()
{
  if (newRpm)
  {
    newRpm = false;
    int smoothrpm = (3*smoothrpm + rpm)/4;  // weighted average
    Serial.print(millis());
    Serial.print(", ");
    Serial.print(rpm );
    Serial.print(", ");
    Serial.println(smoothrpm );
  }
}
Code:
int smoothrpm = (3*smoothrpm + rpm)/4;  // weighted average
I changed to
Code:
int smoothrpm = ((3*smoothrpm + rpm)/4)*4;  // weighted average
this is the result
Code:
rpm 4210   smooth rpm 4208
rpm 3647   smooth rpm 3644
rpm 3726   smooth rpm 3724
rpm 3692   smooth rpm 3692
rpm 3703   smooth rpm 3700
rpm 3715   smooth rpm 3712
rpm 3692   smooth rpm 3692
rpm 3692   smooth rpm 3692
rpm 3680   smooth rpm 3680
rpm 3680   smooth rpm 3680
rpm 3692   smooth rpm 3692
rpm 3669   smooth rpm 3668
rpm 3669   smooth rpm 3668
rpm 3692   smooth rpm 3692
rpm 3669   smooth rpm 3668
rpm 3669   smooth rpm 3668
rpm 3680   smooth rpm 3680
rpm 3669   smooth rpm 3668
rpm 3680   smooth rpm 3680
rpm 3680   smooth rpm 3680
rpm 3658   smooth rpm 3656
rpm 3669   smooth rpm 3668
rpm 3680   smooth rpm 3680
rpm 3680   smooth rpm 3680
Then tried this
Code:
int smoothrpm = ((9*smoothrpm + rpm)/10)*10;  // weighted average
gave this
Code:
rpm 3692   smooth rpm 3690
rpm 3692   smooth rpm 3690
rpm 3680   smooth rpm 3680
rpm 3692   smooth rpm 3690
rpm 3680   smooth rpm 3680
rpm 3680   smooth rpm 3680
rpm 3680   smooth rpm 3680
rpm 3680   smooth rpm 3680
rpm 3669   smooth rpm 3660
rpm 3680   smooth rpm 3680
rpm 3680   smooth rpm 3680
rpm 3680   smooth rpm 3680
rpm 3680   smooth rpm 3680
rpm 3680   smooth rpm 3680
rpm 3680   smooth rpm 3680
rpm 3680   smooth rpm 3680
rpm 3669   smooth rpm 3660
rpm 3680   smooth rpm 3680
rpm 3680   smooth rpm 3680
rpm 3669   smooth rpm 3660
rpm 3692   smooth rpm 3690
rpm 3669   smooth rpm 3660
rpm 3669   smooth rpm 3660
rpm 3870   smooth rpm 3870
rpm 3669   smooth rpm 3660
rpm 3680   smooth rpm 3680
rpm 3680   smooth rpm 3680
rpm 3658   smooth rpm 3650
rpm 3692   smooth rpm 3690
6  Using Arduino / General Electronics / Re: Hall effect sensors on: October 21, 2012, 09:11:44 am
I'll try that out but at the moment have to make a mount for the different reed switch, old was round threaded but new one is oblong.
7  Using Arduino / General Electronics / Re: Hall effect sensors on: October 21, 2012, 06:53:58 am
Rob
Here are the results of your last code
Code:
19444, 3785
19460, 3783
19476, 3777
19491, 3778
19508, 3783
19523, 3780
19539, 3782
19555, 3782
19571, 3780
19587, 3779
19603, 3780
19618, 3782
19635, 3780
19650, 3776
19666, 3776
19682, 3782
19698, 3785
19714, 3787
19730, 3785
19745, 3781
19762, 3778
19777, 3777

Nicogongora
I can see what you mean, this morning I have had consistent results with 9600 but going to 115200 I get fluctuating results.
8  Using Arduino / General Electronics / Re: Hall effect sensors on: October 21, 2012, 04:10:13 am
HW sounds OK.

If the baudrate influences the RPM it might be that the wires influence each other.
You could check if you have the same problems if you take IRQ1 (pin 3)

================

What is strange is that the numbers are much higher than you expect [about 5000]. Is this correct?

Do you have a datasheet of the reed switch used?
What is its upper switch frequency?
First thank you for all the replies as a newbie I really appreciate this forum.
Glad the HW ok

Re baud rate I changed to IRQ1 (pin 3), this work fine on 9600 but on 115200 the readings are all over the place??

Re reed switch I cant find data sheet but what I have done is change the switch for another and this is the result and is no more than 1% different to the electronic tacho.
Code:
rpm37
rpm4363
rpm4332
rpm4363
rpm4347
rpm4347
rpm4580  ^^^^^^^^ Here
rpm4332
rpm4363
rpm4332
rpm4363
rpm4363
rpm4562 ^^^^^^^^^ Here
rpm4347
rpm4347
rpm4347
rpm4363
rpm4347
rpm4347
rpm4562 ^^^^^^^^^^ Here
rpm4347
rpm4347
rpm4580  ^^^^^^^^^^^ Here
rpm4347
rpm4347
rpm4347
rpm4347
rpm4347
rpm4363
Just the few disparities marked. Also tried at lower speeds and slightly higher, the results were as good.
9  Using Arduino / General Electronics / Re: Hall effect sensors on: October 20, 2012, 12:07:47 pm
Have run with different reed switch but only at slow speed. However at 115200 baud the RPM was a steady 740 I decided to change to 9600 I was supprised to see the RPM go up to a steady1560??
10  Using Arduino / General Electronics / Re: Hall effect sensors on: October 20, 2012, 11:20:18 am
Rob
 tried uploading image but did not work.I have from +5v pin to reed switch, from reed switch to pin 2 with a T off to ground pin via a 10K ohm resistor.
11  Using Arduino / General Electronics / Re: Hall effect sensors on: October 20, 2012, 09:57:24 am
Hi Rob
Have tried out both of your above codes, the readings are still too high. I am wondering if it is still the reed switch although the electronic tacho uses this switch.
It seems to be ok up to about 2500RPM and then shoots up. I have tried out also on my workshop pillar dill which at max speed is 2800 and on this the arduino is ok, nice and steady between 2750 and 2850.
The shaft that I want to monitor is driven by a hydraulic motor and if I feather the oilflow to start with it starts and climes from o to 2500 ok but when the flow is full it shoots up but should be no more that 5000rpm max.

Here is the output from your first code
Code:
101, 7722
101, 8910
101, 8910
101, 7722
101, 8910
101, 7128
101, 10099
101, 10099
102, 10000
101, 10099
101, 12475
101, 10693
101, 10099
101, 8910
101, 10693
101, 8910
101, 10693
101, 8910
101, 8910
101, 7722
101, 8910
101, 10693
101, 10099
101, 12475
101, 10693
101, 12475
101, 10693
102, 12352
101, 11881
101, 11287
101, 11881
101, 10693
101, 10099
101, 10693
101, 10693
101, 12475
101, 11287
101, 12475
101, 10693
101, 13069

and the second
Code:
105, 11428
102, 11764
105, 11428
104, 11538
90, 13333
104, 11538
106, 11320
104, 11538
91, 13186
117, 10256
120, 10000
91, 13186
103, 11650
90, 13333
104, 11538
105, 11428
134, 8955
92, 13043
105, 11428
133, 9022
106, 11320
105, 11428
104, 11538
102, 11764
105, 11428
106, 11320
118, 10169
91, 13186
149, 8053
89, 13483
91, 13186
104, 11538
105, 11428

regards Tim
12  Using Arduino / General Electronics / Re: Hall effect sensors on: October 20, 2012, 08:29:10 am
Rob
Will try both later but for now what is the UL in 60000UL ?
13  Using Arduino / General Electronics / Re: Hall effect sensors on: October 20, 2012, 06:36:56 am
Hi Rob
I have tried your code but I am still getting fluctuating output and way higher than reality. Monitor readings below.
Still thinking it could be the reed switch although using another electronic tacho using the reed switch it does not pose any problems, it gives steady accurate output.

Here is the output RPM should be no higher than 5000RPM
Code:
9689124, 123
129136, 18585
141108, 25512
161740, 3122
164620, 10357
162808, 17843
148456, 27651
164244, 6149
166992, 13234
190560, 17894
655320, 480
21667648, 69
130712, 20771
105464, 37122
116100, 7064
125380, 16112
98640, 32645
127852, 978
108672, 12194
141212, 17882
156216, 23846
110932, 5680
106732, 17147
108108, 28029
123488, 34255
140520, 8078
136992, 17046
125316, 28210
138660, 3175
151680, 10813
140284, 20246
153780, 26272
120684, 7832
109128, 19658
123776, 27027
144488, 1732
167332, 8667
421416, 6289
Thanks Tim
14  Using Arduino / General Electronics / Hall effect sensors on: October 20, 2012, 03:56:00 am
I am writing some code to get RPM from a shaft using a magnet and reed switch. However I know that the speed will not be over 5000RPM. The reed switch seems fine from 0 to around 2500rpm but then it jumps up to 9000rpm plus and not very steady. It fluctuates from 9000 to 11000
My question is would a Hall sensor be better and more accurate? what type voltage etc.
Also I have found a  wire hall effect on a machine, how does that work a and how to wire it up.

For info here is the code I am using
Code:
//-----------------------------------------------

  volatile byte rpmcount;
  unsigned long time;
  unsigned int rpm;
  unsigned long timeold;

 void setup()
 {
  Serial.begin(9600);
    attachInterrupt(0, rpm_fun, FALLING);

    rpmcount = 0;
    rpm = 0;
    timeold = 0;
    time = 0;
  
 }

 void loop()
 {
  if (rpmcount >= 20) {
     //Update RPM every 20 counts
    
     detachInterrupt(0);
    
     Serial.print("rpmcount");
     Serial.println(rpmcount);
    
     Serial.print("micros");
     Serial.println(micros());
    
     Serial.print("timeold ");
     Serial.println(timeold);
    
     time = micros() - timeold;
     Serial.print("Time ");
     Serial.println(time);

    RPM= (60000000/time) * 20
     Serial.print("RPM");
     Serial.println(RPM);

     timeold = micros();
     rpmcount = 0;
    
     attachInterrupt(0, rpm_fun, FALLING);
   }
 }

 void rpm_fun()
 {
   rpmcount++;
  
 }

//-----------------------------------------------
15  Community / Website and Forum / Re: Inserting serial monitor in the forum on: October 20, 2012, 02:11:51 am
Actually have been programming since I was 9 years old. I have always used the mouse 'left button to highlight and right button to copy but this wont work on the monitor window. I can highlight ok but cant copy, cant really understand why <CTRL>c does and not with the mouse.
Pages: [1] 2 3 4