Go Down

Topic: easy work!!! (Read 969 times) previous topic - next topic

Alexpaine

Jun 26, 2019, 02:48 am Last Edit: Jun 26, 2019, 03:43 am by Alexpaine
need a very simple code,

I'm working on a simple fuel injector cleaner and I would like a code that will pulse a sold state relay very quickly.
I can add a photo of what I would like the circuit to look like
Thanks Alex

what I would like
1: have two button to control two options
2: button 1 I would like to pulse an led/relay with pwm with 3 different speed levels low, mid, high (high max at 230), with a 5 sec delay in between each cycle and stop at end of cycle
3: button2 turn on this (but instead of an led it will be a relay)

 
Code: [Select]

#define LED 3
#define KNOB 0

void setup() {
  pinMode(LED, OUTPUT);
}

void loop() {
  // Read the value of the potentiometer knob
  int knobValue = analogRead(KNOB);

  // Map the potentiometer value to 1-255
  int intensity = map(knobValue, 1, 1024, 1, 255);

  // Output the respective value to the LED
  analogWrite(LED, intensity);




zwieblum


6v6gt

Maybe a mosfet would be a good alternative to a solid state relay for DC applications such as vehicle electrics.
The analogWrite() statement which you have used in your sample code simply alters the duty cycle but not the frequency which, depending on the board, maybe between 500Hz and 1K. Is that what you want ?

Alexpaine

The On/off time for each cycle will be about 10 Seconds ON 5sec Off

https://youtu.be/e_g9K0VEsfE
 
This is exactly what I want to do

And not sure what it would cost

6v6gt

#4
Jun 26, 2019, 01:41 pm Last Edit: Jun 26, 2019, 02:03 pm by 6v6gt
The video shows the use of a mechanical relay so the frequency can't be much over 50Hz. Anyway, it is not an application for a mechanical relay (as some of the comments have pointed out).
What is the maximum frequency that you can pulse these injectors at ? Can you find a data sheet ?

Edit.
I've just found something here. https://www.thoughtco.com/what-is-fuel-injector-pulse-width-85366 You get one pulse per intake cycle. If the engine is running at 6000 RPM that is  pulse rate of 50Hz. The width of the pulse determines the amount of fuel delivered (say 2.5 to 3.5 mS at idle ).
You can create the timings yourself in the loop() which is easy enough to do because the frequency is low . That would be bursts of x mS on and y mS off.

Go Up