Show Posts
Pages: 1 2 [3] 4 5
31  Using Arduino / Project Guidance / Re: PinChangeInt : Monitoring Marine engine on: May 07, 2012, 07:56:49 pm
Dear DuaneB
guys why wouldn't you use a counter ic as a prescaler on the 6000 pulses per second ?

Could you please give me the part name ?

32  Using Arduino / Project Guidance / Re: PinChangeInt : Monitoring Marine engine on: May 07, 2012, 03:29:04 am
Dear Nick Gammon.

So you would prefer to work with 4925 volts than just have a timer count pulses?

I knew that arduino analog will unable to handle that level of voltage

Well ... actualy after some correction on that ''
with 132 tooth wheel, it can reach 154.985074626866 V at 4720 RPM

Using Voltage devider before entering Analog Pin

using R1=300 Ohm , and R2=10 Ohm
Vout = (R1/(R1+R2)*Vin

The Vout at 4720 RPM will be 4.99951853635051 Volt ... It is compatible with Analog PIN

The problem will : How much is the real max RPM of the engine

33  Using Arduino / Project Guidance / Re: PinChangeInt : Monitoring Marine engine on: May 07, 2012, 02:21:15 am
Dear Nick Gammon.

My apologize, my brain is not good enough to understand your code.
Thats why I look for a dumb work around.

I got additional info about target engine
The engine have 132 tooth flywheel, and max RPM is 2500

and I will use this to convert from Frequency to Voltage

with Magnetic Pickup like above, I thing I can use (cmiiw) the math of :

Freq = Gear x Rpm

means that the max Freq will be : 132 x 2500 = 330,000 Hz

and the max Voltage will be 4925.373134328 V.
Using Voltage devider of factor 0.001 at the Vout point, I'll got max volt of 4.925373 V where the arduino analog pin can handle.
And I thing the max analogread value returnd will be (4.925373/5)*1023 => 1007.7313
That is the max value that will be reported to PC.

Thats what I can thing it so far.

34  Using Arduino / Project Guidance / Re: PinChangeInt : Monitoring Marine engine on: May 07, 2012, 12:22:31 am
Dear Nick Gamon and El_supremo.

I realy appreciate your enlightment.

Hmmm ... second thought ....
What About this :
1. Use PinChange For that 4 Flow meter (Low pulse per minute), and
2. Use Frequency-to-voltage IC and feed the output to Analog pin to read the current engine RPM

Something that noted at page 7 (Minimum Component Tachometer) , Plus a voltage devider .

About periodic Serial.println .... could be done.
Maybe once per second ?

35  Using Arduino / Project Guidance / Re: PinChangeInt : Monitoring Marine engine on: May 06, 2012, 10:44:07 pm
Dear Nick Gammon
I really really appreciate your enlightment

Why not use the external interrupts, rather than the pin change interrupts?
Since there is only 2 external interupts on arduino, while I need to handle 6 pulse source

What is the objective here? To work out the engine speed?

You can use timers to count events like that, which will be very efficient and accurate. I have some examples here:

Really good examples, but I try to off-load the Math/Counting from arduino to a PC. Thats why I just use the arduino as 'pulse to ASCII' translator

36  Using Arduino / Project Guidance / PinChangeInt : Monitoring Marine engine on: May 06, 2012, 10:02:40 pm
Dear All ...

I'm planning on using arduino and a PC as data logger of Marine Engine (tug boat with 2 diesel engine).
The arduino will only function as 'pulse to ascii converter'.
The pulse will come from :
- 4 x Fuel Flow meter
- 2 x RPM (Magnetic Pickup)

Currently all I know is that the max fuel flow is 4L/minute , while the Flow sensor is about 1000 pulse per L.
So for single FlowMeter there will be max of 4000 pulse per minute, about 67 pulse per second.

About the magnetic pickup for RPM :
1. The flywheel is +/- : 200 Tooth
2. Max RPM : 1800 RPM
So the max pulse for the RPM will be around : 360000 pulse per minute , 6000 pulse per second.

So the summary, Arduino will receive (at max) :
1. 4x Interupt , each at 67 Interupt per second
2. 2x Interupt , each at 6000 interupt per second

I'm planing to use PinChangeInt library to receive pulse, something like this :
Adopted from :
#include <PinChangeInt.h>
#include <PinChangeIntConfig.h>

#define FL_A1 14  // Will be flowmeter A1
#define FL_A2 15  // Will be flowmeter A2
#define RPM_A 16  // Will be RPM A

#define FL_B1 14  // Will be flowmeter B1
#define FL_B2 15  // Will be flowmeter B2
#define RPM_B 16  // Will be RPM B

void setup() {
  Serial.print("PinChangeInt test on pin 14-19");

  pinMode(FL_A1, INPUT);     //set the pin to input
  digitalWrite(FL_A1, HIGH); //use the internal pullup resistor
  PCintPort::attachInterrupt(FL_A1, cb_fla1,RISING); // attach a PinChange Interrupt

  pinMode(FL_A2, INPUT);     //set the pin to input
  digitalWrite(FL_A2, HIGH); //use the internal pullup resistor
  PCintPort::attachInterrupt(FL_A2, cb_fla2,RISING); // attach a PinChange Interrupt

  pinMode(RPM_A, INPUT);     //set the pin to input
  digitalWrite(RPM_A, HIGH); //use the internal pullup resistor
  PCintPort::attachInterrupt(RPM_A, cb_rpma,RISING); // attach a PinChange Interrupt

  pinMode(FL_B1, INPUT);     //set the pin to input
  digitalWrite(FL_B1, HIGH); //use the internal pullup resistor
  PCintPort::attachInterrupt(FL_B1, cb_fla1,RISING); // attach a PinChange Interrupt

  pinMode(FL_B2, INPUT);     //set the pin to input
  digitalWrite(FL_B2, HIGH); //use the internal pullup resistor
  PCintPort::attachInterrupt(FL_B2, cb_fla2,RISING); // attach a PinChange Interrupt

  pinMode(RPM_B, INPUT);     //set the pin to input
  digitalWrite(RPM_B, HIGH); //use the internal pullup resistor
  PCintPort::attachInterrupt(RPM_B, cb_rpmb,RISING); // attach a PinChange Interrupt


void loop() {

void cb_fla1()
void cb_fla2()
void cb_rpma()

void cb_flb1()
void cb_flb2()
void cb_rpmb()

My question :
1. Is there any processing time enough for that interupts ?
2. Will the interupts process hit/break/intervere each other ?

Note : Currently I don't have any pulse generators on my desk to simulate the task.

37  Topics / Product Design / Just to share. Arduino eagle library with drilled top side pad on: December 28, 2011, 06:28:48 am
Dear All ..
I don't know if it will have any use or not.

SMD part is easy to get.
But when we design Arduino Shield based on available eagle library .. we need to use Long stackable PInHeader.
This kind of pinheader is hard to find in such are.

So I think we need an eagle library with "pad" on top side.

My try is to use Adafruit library.
I made a note of all :
- Drill Size
- Pad Diameter
- Pad location of each pin
- Pad Names

I delete the original botom side pad ,
Put SMD pad with the size as noted pad diameter and 100% Roundness
Combine it with "Hole" at size of noted drill size

And here it come in attachment,
Note : not tested yet .. maybe you can help me to print it on transparency and compare it with your Arduino board

38  Using Arduino / General Electronics / encoder wheel, just an idea (not tested yet) on: December 12, 2011, 02:35:57 am
Dear All.

I'm just thinking of using CD Plate as encoder wheel.
For those who tried to make "scratchable" digital dj console, always search for rotary encoder that have somany pulse per rotation.

Ok, here it is :
1. Encoder Wheel Generator : I Found will do the job. It will generate the patern as PostScript file.
a. Make sure that the outer diameter is 3.5 inch .. or alternatively you can also write it in mm.
b. make sure that the Long and width of the page is also 3.5 inch , and all margin is 0.
c. Other configuration ... please read the script it self.
d. open the ps using your flavor of image editor that can open PS and save it as Bitmap ... let's save it as "ew.png"

2. LaCie Labeller ( )
This is the tool to do LightScribe ....
LightScribe is at

Create new label with it, Import our generated patern image to it ... and allign.

Originaly, lacie is use to "burn" bitmap picture to the "label area" of the plate ...
That is they said "burn, flip, burn" ... what we do is the second burn.

But rather than fliping it .. we just burn it to the data area of the plate ... remember to use New Plate.

This way ... the writer will "destroy" some reflective layer of the plate .. but it do it based on our generated patern from Step #1.

I Still have a question : What is the dimmension of "black" and "gap" that acceptable by the sensor ?

I think we can get 2000 pulse per rotation encoder wheel ... as long as it is acceptable by the sensor.

39  Using Arduino / General Electronics / Re: Suggestions on controlling line voltage for switching on/off lights and neon on: December 01, 2011, 03:42:27 am

What actualy is your goal ?

Do you want to controll the lamps from your PC ?

40  Using Arduino / General Electronics / Re: Weight Sensor on: November 30, 2011, 04:44:45 am
This one is useable

41  Using Arduino / General Electronics / Re: Suggestions on controlling line voltage for switching on/off lights and neon on: November 30, 2011, 04:30:15 am

In the office I have switches to turn on/off the 2x Office Neon (one switch), the Budget Inn neon (one switch), the main sign (one switch), the office lights (one switch), the car port lights (one switch), an outlet outside of the office (one switch), and a few additional switches that appear to be legacy and no longer appear to work.

Basically, would these relay modules be able to handle dealing with the neon lights, or would I need something a little more beefy?

My 1st question : How you want to control all the lamp/loads ? I mean ... do you want the Arduino work independently or connected to a computer ?

Basicaly, all "digital switching" use some kind of relay.
You can controll your relays using MCU, MCU+PC, or just simply PC Paralel Port (If you still have one).
Since RELAY have a potential on doing some harm thing to MCU/PC ... peoples put some protection betwen them, the simplest thing is using darlington array ULN2803 ... or better with Opto Coupler.

First step, you need to know the max load that will handled by each relay, i.e :
- the switch that on/off 2 lamp at the carport : What is the wattage number of each lamp ? what is your voltage ?
If each is lamp is 100 watt, and your voltage is 110 .. then you will need a relay that capable to handle at least 3 Amp at 110 ... most of them capable up to 5 Amp

anyway ... Do you familiar with soldering and basic fabrication of box ?
If not ... I thing you better consider

42  Using Arduino / General Electronics / Re: Which one will work ? on: November 30, 2011, 04:06:28 am
As to your other problem, why not have the relay and LED on the same pin? LED+resistor from +5V to the pin, and Relay from Ground to the same pin.
If pin is high, Relay will be energized and LED off. If pin is low, Relay will be de-energized and LED on.

Yes I did, i.e:
Inverter input-pin1 , goes to Arduino Analog-pin0
ULN2803 input-pin1, also goes to Arduino Analog-pin0

Relay is drived by ULN2803 output-pin

43  Using Arduino / General Electronics / Re: Which one will work ? on: November 29, 2011, 05:53:32 am
Both of those circuits should control the LEDs, are you saying that neither work?
Unfortunately ... yes

Have you set the pins to be outputs?

Show us the code.

Pin definition and setup()

const int pwr_pin[6]={14,15,16,17,18,19};
void setup()
  for (int i=0; i<6; i++){
    pinMode(pwr_pin[i], OUTPUT);
  Serial.println("system startup");
  //Serial.println("Waking up GSM modem ... need some times");
  gsm.TurnOn(9600);          //module power on
  gsm.InitParam(PARAM_SET_1);//configure the module 
  gsm.Echo(0);               //enable AT echo
  Serial.println("Ok .. Let's go !");

Function that set the pin HIGH/LOW

void do_pwr(char* sms_rx){
  //Serial.println("Switching Power");
  //Let's parse power control commands
  int sms_rx_pos=0;
  char cmd_text[2]={};
  int cmd_pos=0;
  int thispin = 0;
  for (sms_rx_pos=4;sms_rx_pos < strlen(sms_rx);sms_rx_pos++){
        if (sms_rx[sms_rx_pos] == ','){
          cmd_pos=0 ;
        } //End of ','
        if (cmd_pos==0 && sms_rx[sms_rx_pos]>'0' && sms_rx[sms_rx_pos]<'7'){
                //Serial.print("Set Pin ");
                thispin = cmd_text[0]-49;
        } // end of cmd_pos =0
        if (cmd_pos==1){
          //Serial.print("--->TO : ");
          char pwr_ctrl_type = toUpperCase(sms_rx[sms_rx_pos]);
          //Serial.print(" >> ");
          switch (pwr_ctrl_type) {
            case 'U':
              // It's NC , So "UP" Means LOW
            case 'D':
              // It's NC , So "DOWN" Means HIGH
            case 'R':
              //High First
              //wait 2 secs
              //And then LOW             
            default :
          } //End of Switch Case
        } //end of CMD_pos=1
  } //end of for-loop

But I doubt you need either if all you want is a status for the relay. You can put a LED in parallel with the relay coil or directly on the Arduino pin.

How are you controlling the relays?


Well ... since it's NC relay, I need to set the control pin HIGH.
If I put led just paralel with relay ... the LED will "ON" while the relay load "OFF".
Thats why I put NOT gate between controll pin and LED

Meanwhile .. somebody told me to decrease the LED and R size.
I'll try it and 'll back here.

I realy appreciate your response.

44  Using Arduino / General Electronics / Which one will work ? on: November 28, 2011, 11:18:04 pm
Dear All ..

I'm building relayboard control with arduino.
I use Analog pin to signal the relay ... using simple digitalWrite to analogpin.

The problem is not with the relay .. but I want to "status" indicator using Leds.
Since the relay will operated at NC, I need to Inverting the logic state that signal the LED.

That is : When digitalWrite(A0, HIGH)  .. I want LED#1 Down.

I think that Hex Inverter will do .. so I pick 74HC04P for me.

But I failed to interface 74HC04P to my arduino, the LEDS always off.

Attached is my schematic (from eagle).
Kindly please tell me which one of this schematic will work ?
The top one (74HC04P as "source") ?
or the bottom one (74HC04P as "Sink") ?
or both will not work .

45  Using Arduino / Installation & Troubleshooting / Re: where is the "elf" and "cpp" files ? on: November 25, 2011, 11:13:49 pm
Dear RadMan and Magician.

I Really appreciate your enlightment

Pages: 1 2 [3] 4 5