Hello all,
i try to make a ignition for mu two stroke engine.
Here is my code below,
i wonder is it wrong or...
Pin 9 doesnt come high or low.
If i put a 5 volt on it the coil sparks.
Do i miss something?
regards`
`const int hallPin = 2; // Pin voor Hall-sensor
const int coilPin = 9; // Pin voor bobine
void setup() {
pinMode(hallPin, INPUT_PULLUP); // Hall-sensor met interne pull-up
pinMode(coilPin, OUTPUT); // Bobine-uitgang
Serial.begin(9600); // Debugging
Serial.println("Testprogramma gestart");
}
void loop() {
// Wacht op een Hall-sensorpuls
if (digitalRead(hallPin) == LOW) {
Serial.println("Hall-sensor actief!"); // Debugging
digitalWrite(coilPin, HIGH); // Zet bobine aan
delayMicroseconds(100); // Houd 100 microseconden hoog
digitalWrite(coilPin, LOW); // Zet bobine uit
delay(200); // Wacht om overtriggeren te voorkomen
}
}
``
Welcome to the forum
You started a topic in the Uncategorised category of the forum when its description explicitly tells you not to
Your topic has been moved to a relevant category. Please be careful in future when deciding where to start new topics
Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'
Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination
https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum
Please post your sketch, using code tags when you do
Posting your code using code tags prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination
In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.
But does the message get printed? If it does, how do you know the pin does not go high?
When you re-post your code include an annotated schematic showing your circuit.
Do you understand that the spark is caused by the current, Amperes, flowing from the 5 volts? The 5 volts on your Arduino is for signalling, not supplying more that a tiny current. You can certainly add a transistor that will handle the current and the Arduino pin can control that transistor.
1 Like
Preimert:
Do i miss something?
yes - we need to see a schematic.
When you submit a question on the forum you will usually need to add a schematic (circuit diagram).
The tutorial that follows will explain some ways to create a useful image; however lets start by explaining how to add the image to your post. Its easy.
Having created the image all you need to do is :
Save the image somewhere convenient - maybe your desktop
Start your post, and place the cursor (insertion point) where you want the image to be shown;
[upload image to forum]
3: click th…
Hi ,thanks for your reply.
I measured pin 9 with a multimeter.
regards.
add a transistor that will handle the current and the Arduino pin can control that transistor, which i did. i use a tip 120 for testing.
My igniter is same as the picture
jim-p
December 22, 2024, 11:48am
12
Please follow the advice given in post #2 regarding the proper way to post your code.
I will try, this is all new to me how to post.
jim-p
December 22, 2024, 11:53am
14
In the IDE click on Edit, then Copy for Forum. That will copy your code for pasting on this forum. Then come back to the forum and just do a paste.
HI, @Preimert
Welcome to the forum.
Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.
Thanks.. Tom.....
jim-p
December 22, 2024, 1:08pm
17
I see two things wrong with your diagram.
220K ohms is way to big try 470 ohms
Your coil has no ground return
1 Like
Can your multimeter measure a pulse that is 100 microseconds long?
i changed the values for triggering time. it all works well now.
thanks for attention from everyone.
system
Closed
June 20, 2025, 4:20pm
20
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.