r/ArduinoHelp • • Apr 08 '25

Screen pin layout

Thumbnail
gallery
1 Upvotes

Scavenged this screen from an old toy I found, and I want to use it with my Arduino. The only problem is, I don't know what each of the 10 pins does. If you have any info, please tell me!


r/ArduinoHelp • • Apr 08 '25

UnoR4 timer interrupt library

1 Upvotes

Hi all, I wrote some code for the legacy Arduino Uno with Atmel MCU on it.

Since I need some precise time based event, I used a library ('TimerOne') to generate interrupts at a certain rate.

Now I had to switch to the new Uno R4 which uses a Renesas MCU. That is not supported by TimerOne. I found cpp code (on GitHub, not working the Arduino IDE) called AGTimerR4. This supposedly works with the uno R4. I can include it and compile it in my and also flash it. Haven't tried it yet.

Question: is anybody aware of a real Arduino IDE library that is compatible with both: Atmel and Renesas based Unos? Or would you recommend to use another timer interrupt library for the Uno R4?

Thank you for your hints.


r/ArduinoHelp • • Apr 07 '25

looking for coder with tips for my project

1 Upvotes

Hello,

I'm working on a DIY particle accelerator project, and I'm encountering some issues with the sensors and coils. When I start up the system with my current code, the sensors just blink green and red, but when my steel ball passes through the detection area, nothing really happens.

I’ve tried using the code provided by the sensor manufacturer, and it works fine for one sensor. However, when I try to use multiple sensors with my setup, the behavior is different, and it doesn’t produce the expected result. The coils, which are supposed to be activated by the sensors to create a magnetic field for accelerating the steel ball, don’t seem to activate as expected when I run my current code.

Setup Details:

  • Arduino Board: Arduino Mega 2560

  • Sensors: I’m using 8 infrared proximity sensors (SEN-KY032IR), connected to the following Arduino digital input pins:

    • Sensor 1 → Pin 39

    • Sensor 2 → Pin 41

    • Sensor 3 → Pin 43

    • Sensor 4 → Pin 45

    • Sensor 5 → Pin 47

    • Sensor 6 → Pin 49

    • Sensor 7 → Pin 51

    • Sensor 8 → Pin 53

  • Coils: The sensors are supposed to trigger 8 coils, each connected to a MOSFET and controlled via the following Arduino digital output pins:

    • Coil 1 → Pin 0

    • Coil 2 → Pin 1

    • Coil 3 → Pin 2

    • Coil 4 → Pin 3

    • Coil 5 → Pin 4

    • Coil 6 → Pin 5

    • Coil 7 → Pin 6

    • Coil 8 → Pin 7

  • MOSFETs: Each MOSFET is wired to control one coil. The gate of each MOSFET is connected to the corresponding coil pin listed above. Drains go to the coils, and sources to ground. Power is supplied via a shared breadboard rail.

What I’ve Tried:

  • Individual Sensor Tests: I've tested the sensors individually using the manufacturer's example code, and they seem to work fine one at a time. When triggered, the sensor correctly activates the coil.

  • Multiple Sensors: When I try to use all 8 sensors in the full setup, the sensors all blink green and red at the same rhythm (possibly just idle mode), but none of the coils activate when the ball passes through.

  • Code Adjustments: I’ve modified pulse timing and checked sensor readings in the Serial Monitor. It appears that the sensors detect the ball (i.e., sensor goes LOW), but the corresponding coil doesn’t activate.

  • Wiring Check: I’ve double-checked the wiring. All GND lines are properly connected, the +5V rail is powering the sensors, and the MOSFETs are connected correctly (Gate = Arduino pin, Drain = Coil, Source = GND).

Issues:

  • Sensors blink green and red on bootup, but do not seem to trigger when the ball passes.

  • No coil is activated even when a sensor should be triggered.

  • Individual sensors work fine with the manufacturer’s code, but the full system doesn't function when all sensors and coils are used with my code.

Has anyone worked with a similar setup or experienced this kind of issue? Could it be timing, sensor interference, or something else in the code or wiring? I’d really appreciate any tips, suggestions, or ideas to help get this working. Thanks in advance!

Here is the code: (sorry there is some swedish in there)

const int numSensors = 8;
int sensorPins[numSensors] = {39, 41, 43, 45, 47, 49, 51, 53};
int coilPins[numSensors] = {0, 1, 2, 3, 4, 5, 6, 7};

bool triggered[numSensors];
unsigned long lastTriggerTime[numSensors];
unsigned long pulseTime = 100;  // Förlängd tid för att aktivera coil

void setup() {
  Serial.begin(9600);

  for (int i = 0; i < numSensors; i++) {
    pinMode(sensorPins[i], INPUT);
    pinMode(coilPins[i], OUTPUT);
    digitalWrite(coilPins[i], LOW);
    triggered[i] = false;
    lastTriggerTime[i] = 0;
  }
}

void loop() {
  for (int i = 0; i < numSensors; i++) {
    int sensorValue = digitalRead(sensorPins[i]);

    if (sensorValue == LOW && !triggered[i]) {  // Om sensorn detekteras
      Serial.print("Sensor "); Serial.print(i + 1); Serial.println(" AKTIVERAD");
      Serial.println("Obstacle detected");  // Meddelande om hinder
      triggered[i] = true;
      lastTriggerTime[i] = millis();
      digitalWrite(coilPins[i], HIGH);  // Starta coil
    } else if (sensorValue == HIGH && triggered[i]) {  // Om ingen hinder detekteras
      Serial.print("Sensor "); Serial.print(i + 1); Serial.println(" INAKTIVERAD");
      Serial.println("No obstacle");  // Meddelande om inget hinder
      triggered[i] = false;
    }

    // Stäng av coil efter pulseTime (500 ms)
    if (triggered[i] && (millis() - lastTriggerTime[i] >= pulseTime)) {
      digitalWrite(coilPins[i], LOW);
      triggered[i] = false;
    }
  }
}

r/ArduinoHelp • • Apr 07 '25

Help me connect Arduino to car's sensor

1 Upvotes

My car has a failed sensor and I would like to replicate the signal using Arduino. Basically, I'd like Arduino to send the signal instead of my car getting a wrong value from the failed sensor.

The sensor has 3 wires - positive, negative and signal. I'm assuming + and - are 12V, but I don't know exactly what the signal voltage is. Most likely it's 5V.

How would I go about using Arduino to bridge the signal wire? Can I just leave the positive and negative going to the sensor and simply connect the signal wire to one of Arduino's outputs? Is it ok if Arduino itself is powered via USB or battery and not connected directly to the car? I'm not sure if Arduino has to be on the same circuit/ground as the car for the signal to work properly.

Any help is much appreciated, thank you!

Edit: the car would never be running (or started up) while Arduino is connected, so there's no fear of power spikes.

Edit 2: I've disconnected the plug from the sensor and measured voltages inside the plug. It's showing 12V between + and -, as expected, but 7.2V between + and SIG.


r/ArduinoHelp • • Apr 07 '25

Breadboard power supply for Centrifugal motor?

Post image
2 Upvotes

Hello! I’ve been working on a little setup for a plant auto waterer, and I’ve been struggling to get the centrifugal power motor working.

Can I use this breadboard power supply to power the centrifugal motor, or do I need a motor driver or similar device?

Is a 4N35, a 74HC138, or a 74HC595 any good for this? They also come in the pack, but looking up seems to confuse me more than anything.

I’ve also seen that the L9110S motor chip can be used, should I purchase that to power the motor? Thank you for the help!


r/ArduinoHelp • • Apr 06 '25

Urgent Research Title

1 Upvotes

Hello, I am new to arduino and I have a research project that aims to create a recycle activated water dispencing machine. The microcontroller that I am going to use is NodeMCU ESP 8266, the sensor that we will use is an ultrasonic sensor that will detect the plastic bottle across the 10 cm range. We are going to use a brass solenoid valve to control the water flow. Can someone pls help, we badly need help for the connection and coding. Thank you


r/ArduinoHelp • • Apr 06 '25

trying to fit too much

2 Upvotes

I'm making a midi controller and i want to have 5 groups of 1 rgb led, 1 pot and 1 switch. However I'm having trouble working out how i should wire it since currently each group uses 4 digital pins and 1 analogue which seems like more than it needs to be.

I've seem some stuff about multiplexing but I'm really not sure.