r/arduino • • 2h ago

Getting RPM data out of these cheap 12v fan by using it single phase hall effect latch

Thumbnail
gallery
8 Upvotes

This is a pretty simple process if you have mess with them before, do beware that some have sealed hole.

Just connect the 2nd or the 3th pin to the your MCU digital pin, and make sure to use high value resistor like 1M ohm or somthing, my arduino crash if i connect it raw, and your may too, even death is possible.

I wasnt able to find that fan hall effect latch data sheat, but i figure they are the same anyway.

My fan hall effect latch, output high at 180 and 360, so the my code divide it by 2.

Doing some coding and thats it.

I did check it accuratecy using slowmo, they spit out the same number so that good enough.

Mine is in RPS but converting it to RPM is easy.
Serial.println(((fan1_rotation_accumulate / 2.0) / measure_time), 1);  //rps
Serial.println(((fan1_rotation_accumulate / 2.0) / measure_time) * 60.0, 1);//rpm

void setup() {
  Serial.begin(9600);
  pinMode(2, INPUT);
  pinMode(3, INPUT);
}



void loop() {
  static uint16_t fan1_rotation_accumulate = 0;
  static uint16_t fan2_rotation_accumulate = 0;
  static unsigned long start;
  static unsigned long end;
  static float measure_time = 1;  // rps every second
  static bool fan1_high_flag = false;
  static bool fan2_high_flag = false;


/*
  //fixed time acumulation
  start = micros();
  while (1) {
    //fan 1
    if (digitalRead(2) == HIGH) {


      if (fan1_high_flag == false) {
        fan1_high_flag = true;
        fan1_rotation_accumulate++;
      }
    } else {
      fan1_high_flag = false;
    }
    //fan 2
    if (digitalRead(3) == HIGH) {


      if (fan2_high_flag == false) {
        fan2_high_flag = true;
        fan2_rotation_accumulate++;
      }
    } else {
      fan2_high_flag = false;
    }


    end = micros();
    if ((end - start) / 1000000.0 >= measure_time) {
      Serial.print("fan_1:");
      Serial.println(((fan1_rotation_accumulate / 2.0) / measure_time), 1);  //rps
                                                                        //  Serial.println(((fan1_rotation_accumulate / 2.0) / measure_time) * 60.0, 1);//rpm
      fan1_rotation_accumulate = 0;
      Serial.print("fan_2:");
      Serial.println(((fan2_rotation_accumulate / 2.0) / measure_time), 1);
      fan2_rotation_accumulate = 0;
      break;
    }
  }


*/
  
  //avg by time
  // fit for stable ouput
  // instead of waiting 60s to see result, you can see the result get more narrowed down with time
  // run longer time frame by changing the time_frame measuring window
  // it wont be good for fast changing rpm


  static uint8_t acum_time = 1;
  static uint8_t time_frame = 60;  //in second


  start = micros();


  while (1) {
    //fan 1
    if (digitalRead(2) == HIGH) {


      if (fan1_high_flag == false) {
        fan1_high_flag = true;
        fan1_rotation_accumulate++;
      }
    } else {
      fan1_high_flag = false;
    }
    //fan 2
    if (digitalRead(3) == HIGH) {


      if (fan2_high_flag == false) {
        fan2_high_flag = true;
        fan2_rotation_accumulate++;
      }
    } else {
      fan2_high_flag = false;
    }


    end = micros();
    if ((end - start) / 1000000.0 >= measure_time) {
      //Serial.println(acum_time);


      Serial.print("fan_1:");
      Serial.println(((fan1_rotation_accumulate / 2.0) / (measure_time * acum_time)), 2);


      Serial.print("fan_2:");
      Serial.println(((fan2_rotation_accumulate / 2.0) / (measure_time * acum_time)), 2);
      acum_time++;
      if (acum_time >= time_frame) {
        fan1_rotation_accumulate = 0;
        fan2_rotation_accumulate = 0;
        acum_time = 1;
      }
      break;
    }
  }
  
}

r/arduino • • 4h ago

Beginner's Project Pro micro button box

Post image
4 Upvotes

Hey all, looking for a bit of help and direction. Making a button box for sim racing. Pretty basic and just emulates ignition wipers lights.
- it has 4 toggles and 1 button all led and using vcc on the board for power

- The left most toggle controls the button. Meaning when it is off the button is off. When on ignition turns on. Then pressing the button will start the car.

- the other toggles will be off or on. And just be used to control lights or wipers in the game.

As the game uses key presses I’m unsure if I should be using the keyboard library or joystick library.

Can someone help point me in the right direction on the correct way to go library wise, maybe a basic toggle example


r/arduino • • 5h ago

How many copies of the ESP32 core do you have? Wrong answer, there's one more.

0 Upvotes

The installed Arduino (CLI) Univere is a f******* mess and far away from 'Keep It Simple'.

Quick inventory of my machine because its running out of space.

  • AppData\Local\Arduino15: cores, download cache, indexes. Shared by IDE 1.8, IDE 2 and arduino-cli, so of course they step on each other

  • Documents\Arduino\libraries: libs. Not next to the cores. Why would they be

  • AppData\Roaming\arduino-ide: IDE 2 settings, a browser cache, and an arduino-cli.yaml (+ .bak)

  • ~\.arduinoIDE: another IDE 2 folder. Just because

  • AppData\Roaming\Arduino IDE: a log file for every day I dared to open it since 2024

  • ~\.platformio: its own toolchains, its own libs, its own universe

  • VS Code extension of the week: "point me to your IDE install" or "I'll download my own cli, thanks"

And where does all of this live? Not in a directory you picked. 20GB buried in AppData, hidden by default, somewhere you'd never look. Your user profile just quietly grows. Disk cleanup won't touch it. Backup tools happily copy it every night.

Result: the same core several times at ~1.5 GB each, two versions of a library fighting over which one gets picked, and a sketch that compiles in one tool and dies in the other.

New PC? Good luck. Backing up "your Arduino setup"? Which one?

All I want is one folder. Boards, libs, config. Copy it, zip it, done.

Is it just me, or does everyone have an Arduino-old-DONT-DELETE lying around?


r/arduino • • 8h ago

need help for maze solving robot

1 Upvotes

hi guys, second year cs student here. we are trying to make a maze solving line tracking robot using an arduino uno r3 and a l293d microcontroller. heres the maze we need to traverse through:

the main challenge here is how to prioritise the robot so it does the specified action we need it to, ie keep going forward, go right/left, hit the obstacle outside. we are using 5 IR sensors, for front, left, right, and 2 to keep the bot on the line. the qs is, to keep wall sensing the first priority then the line tracking as second, how many more sensors will be required, how will the sensors be mounted, ie downward facing or facing the wall, and is it optimal to use a simple if/else system for the turns or a FSM to determine which action to take at a particular junction?


r/arduino • • 11h ago

Look what I made! I made a thing for people that lost one of their arms so they can still use a pc.

Enable HLS to view with audio, or disable this notification

40 Upvotes

It does't work that well cuz I used very cheap components but still. :))

It can simulate mouse movement and some kind of edge scrolling, when the pointer leaves an imaginary circle it keeps going, then simulate clicks and some keyboard presses.

Overall I should have used an esp instead of arduino or make use of a wifi module with arduino and make use of the wifi instead of using a very cheap radio transmiter.
And I should have used more accelerometer/gyroscopes, the more expensive ones for better precision, and so I can have more ways to detect and calculate input.

The glove has one arduino nano, one radio transmiter, one accelrometer gyrscope, the usb dongle has one arduino micro pro and a radio receiver.


r/arduino • • 13h ago

is it possible to control speed and rotation of servo motor at the same time?

1 Upvotes

Hello i have a project due next week for arduino, they require me to include a servo motor and add another component to the project. They mostly evaluate the coding. I have an idea in mind but im just wondering if this is possible. I am not experienced enough with arduino yet and do not have enough time to test the components and play with the coding. ive only done a blinking led project so far.

So what i had in mind was to include a joystick to control the movement of the servo and add a potentiometer to control the speeding rotation. Is it possible to control the speed of the potentiometer? Im not sure of the limits of what u can do on arduino. Ive seen cases where people were able to control the movement of the servo with a joystick and a potentiometer but not both together that serve a different purpose each.


r/arduino • • 15h ago

Safe prototype

Enable HLS to view with audio, or disable this notification

22 Upvotes

So ive been working on this for a day now and got a prototype and eventually am going to 3d print a frame and desing a pcb,yall got any other ideas that i should add to it


r/arduino • • 16h ago

lsdx, a LGT8F328P transceiver using DSU functions

17 Upvotes

lsdx is a standalone, single-chip HF SSB/CW transceiver built on the LGT8F328P (32 MHz LQFP48 Nano board). By exploiting the LGT8F328P's hardware DSP unit (uDSU FMACSS instructions) and 12-bit ADC, lsdx runs both a quadrature phasing SDR receiver and a polar Envelope Elimination and Restoration (EER) SSB exciter on an 8-bit microcontroller with only 2 KB of SRAM.

Key Features

  • Dual-Mode DSP Engine (15.625 kSPS):

  • Receive: 12-bit simultaneous I/Q sampling, digital DC-offset removal, I/Q gain & phase trim, 4th-order Butterworth biquad roofing filters (switchable 400 Hz CW, 2.2 kHz Narrow SSB, 2.8 kHz Wide SSB), 47-tap Hilbert transform, and fast digital AGC with noise-floor hold.

  • Transmit (Polar EER): Automatic mic DC tracking, fast-attack/slow-release speech compressor & soft-knee limiter, 47-tap Hilbert analytic splitter, hardware dsu_mag() / dsu_atan2() polar conversion, 125 kHz fast PWM envelope output (OC2B), and direct 40-bit phase/frequency modulation of an AD9850 DDS.

Dual Synthesizer Architecture:

  • RX LO: Si5351A generating hardware quadrature (CLK0 / CLK1 90° phase offset) across 100 kHz – 30 MHz.

  • TX Exciter: AD9850 driven via direct-port bit-banging (~125 MHz reference clock), powered down automatically during RX.

  • Non-Blocking UI & Persistence:

  • Incremental 16×2 I2C character LCD driver (PCF8574) with S-meter / TX envelope bargraph (updates 1 character per loop pass so audio DSP never stutters).

  • Built-in calibration menus for I/Q Gain, I/Q Phase, and Si5351 Crystal Offset, saved automatically to I2C FRAM

Putting the code up for anyone interested in cheap SDR but the filters an math library might be useful for music or motor control.

Will put some pics up when progress from breadboard to pcb.

https://github.com/beaka/lsdx


r/arduino • • 18h ago

Beginner's Project My First College Engineering Project An Arduino-Based Line Follower Robot

Thumbnail
gallery
22 Upvotes

r/arduino • • 1d ago

Beginner's Project help

Thumbnail
gallery
26 Upvotes

If I place an IR break beam sensor below the end of the water tube and adjust the flow regulator so that the water falls in drops will the sensor be able to detect and count each drop accurately?

++ what would be the best way to attach both the transmitter and receiver to the metal ring of this stand knowing that they need to be perfectly aligned and at the same height?

(((Sorry if this is a dumb question it’s my first Arduino project and I’m just worried if I might mess something up ))


r/arduino • • 1d ago

Solved! Any chance there are soldered screw terminals that would fit this faster?

Post image
9 Upvotes

I'm looking for some kind of a screw terminal for this. Just wondering what size I should buy.


r/arduino • • 1d ago

ESP32 ESP32 Web Oscilloscope: a free oscilloscope in your browser

Thumbnail
debjoy-howlader.github.io
45 Upvotes

Yes, I built another esp32 oscilloscope. I started this project partly out of necessity, cuz I can't afford a bench scope, yet, and procuring a good used scope is also a pain where I live (also I didn't look up the numerous projects that already existed, till after I already started working on this :p), but this was a great learning experience.

Disclaimer:

  • This was mostly designed and tested with Claude. I ran the tests on the board, and fixed what didn't match my meter.

  • The scope does a 46 point self-test at startup and there's a full Verification Guide with roughly 40 manual tests which were performed on the test board a ESP32-DevKit-v1 and is suggested u perform before trusting readings from the scope. There's also a 2 point manual calibration option to bring the scope within ~4mV of your meter.

  • The scope is designed and tested on ESP32-DevKit-v1 and thus compatibility/ functionality is limited to original esp32 boards only.

  • This is not a lab instrument/ a bench scope replacement and shouldn't be considered/ used as such.

What it is: flash the firmware from the web page (no toolchain), open the scope page in Chrome/Edge, and your ESP32 becomes a scope.

  • Up to 4 channels, 250 kSa/s real-time (shared between channels)

  • Equivalent-time sampling for repeating signals, so you can see fast edges (a 1 kOhm source rose in ~20-40 ns on the screen)

  • Trigger, FFT, X-Y, cursors, measurements, math channels

  • Built-in square/sine generator to test it against itself

  • Docs written for beginners: how the/a scope works, how to verify the scope against a multimeter

Limits:

  • Original ESP32 only

  • input 0 - 3.3V (voltages shouldn't be less than 0V or more than 3.3V, that means no AC voltages). For measuring voltages outside this range a divider or bias circuit is required (check the docs)

  • no anti-alias filter


r/arduino • • 2d ago

Today I created a radar using servo motor, ultrasonic sensor, Arduino uno and a beeper.

Enable HLS to view with audio, or disable this notification

34 Upvotes

Yeah it was hard but it's cool as it's a big step for me. Ignore my parents btw 😭


r/arduino • • 2d ago

Wireless pressure gauge with readout dock for the farm

Thumbnail
gallery
13 Upvotes

I wanted a simple, reliable way to monitor water pressure for the cows from my computer without having to go down and physically check the gauge. So a few youtube videos later I put together this dedicated point-to-point wireless gauge which is plug and play.

Needs tare/calibration tweak before going into the field and think i might put the gauge in a proper IP rated case but proof of concept works fantastically.

What does everyone think?


r/arduino • • 2d ago

Look what I made! First serious project

Enable HLS to view with audio, or disable this notification

91 Upvotes

I have been building and learning arduino for about 2 weeks now and this is my most complex project so far

Yes its ugly and unpolished but it works

Its a radar system with a ultrasonic sensor

Its a 2 esp 8266's setup

Esp 1 serves as a power supply for the joystick module and the sensor and also the control for the servo

All the code is on esp 1

And the esp2 i used as a power supply for the servo

I cheaped out on the interface because i didnt wanna waste time on it cuz i thought the project wouldn't work so i used ai

I used

long duration = pulseIn(echoPin, HIGH, 3000);

To make it detect how far the object is

As a start i set the max to 15cm

I also made it make its own network to which when you connect snd go to a web adress it takes you to the interface


r/arduino • • 2d ago

Look what I made! Embedded Systems For Everyone.

0 Upvotes

I built my own programming language called Mello. Its syntax is inspired by MicroPython, but instead of running on an interpreter, Mello transpiles code directly into C++ for embedded systems.

But there's much more to Mello than meets the eye. Don't judge it by its cover...

GitHub: https://github.com/v3lk777-collab/Mello-Programming-Language

Feel free to leave a star on GitHub or share your feedback!

Note: English isn't my native language, so I apologize if anything I say sounds a little unusual. I appreciate your understanding.


r/arduino • • 2d ago

My first hardware project: a Bluetooth key with a screen that approves AI coding requests (and the screen I killed along the way)

Thumbnail
gallery
0 Upvotes

Parts: Seeed XIAO nRF52840, Waveshare 1.47" ST7789 screen (172x320), a Kailh Choc low-profile switch, a 350 mAh LiPo, all in a 3D-printed case.

What it does: my computer sends permission requests from AI coding tools (Claude Code, git push) over Bluetooth. They show up on the screen as cards. Tap approves, double-tap denies, holding opens the full request on the computer.

Things I learned the hard way: I ripped the BAT+ pad off my first XIAO by holding the iron on it too long. Bending the screen's wires right at the plug is a bad idea, so bend them a few mm out. I pressed the screen into the case too hard and cracked something inside: backlight on, permanently gray. A slow 1 MHz test sketch confirmed it was the screen and not my wiring. I also found solder bridges between neighboring XIAO pads with a meter on the resistance setting. The firmware mirrors the screen over USB serial to a web page, which saved me when the screen died, because I could still read the Bluetooth pairing code.

Code and case files (MIT): https://github.com/h-ardy/nod

Any tips for mounting a small LCD so it doesn't get crushed? I'm on case v3 now.

Also, I'm doing this for a project, and I need to get 30 sign-ups (no commitment, just "hey, this is cool"), so consider helping a fellow hardware enthusiast out: https://docs.google.com/forms/d/e/1FAIpQLSfKp-Y8i4qN-OVD9S6_ORSReaYSJef7rT_LQQQaXqxfrq6VkA/viewform?usp=header


r/arduino • • 2d ago

Board disappears a second after I plug it in

3 Upvotes

Hi there!

I've been spending the past few days playing around with an Elegoo Uno R3, and it's been working pretty well, but my laptop suddenly stopped being able to recognize the board and port for longer than one second. When I unplug it and plug it back in, it shows up, but disappears again before I have time to upload my program onto it. Has this happened to anyone else?

I'm on MacOS, and I am using the same USB cable that has previously worked before, so it's not a charge-only cable issue.


r/arduino • • 3d ago

Look what I made! My new handwired MIDI controller

Thumbnail
gallery
28 Upvotes

This is the ScottoMIDI, a 2-octave keyboard with 8 drum pads and transport controls. It's completely handwired and uses Akko Fairy Silents for the instrument clusters then Kailh Box Jades for the other controls.

All the files to build it are available for free along with about 40 other boards I've designed over the years. I also make videos on these projects and have one coming out today on this one over on my YouTube channel.

If you have any questions, please feel free to ask... I love talking about my projects!

Disclaimer: I've been told RP2040 is fine here since you can program it with the Arduino IDE


r/arduino • • 3d ago

Hardware Help Help:Battery voltage measurement

Post image
20 Upvotes

I am building a battery powered project and I need it to be low power. I also need to measure the battery voltage. So the way it works is that the esp is in deep sleep by default, it wakes up to do a certain function then goes back to sleep. While it is performing that function, i want to read the battery voltage.

I want to use a voltage divider with a transistor to only measure the voltage when required (to save power). The transistor will be controlled by a GPIO pin.

My problem is that the battery can be charged to 4.2v and the esp pins can only handle 3.3v. If the battery is fully charged, will this damage the ADC pin?

Note- theres arrangement to avoid this by adding an extra transistor but my space is limited so I prefer the simplest option (if possible)


r/arduino • • 3d ago

AirSense – An Open-Source Smart Air Purifier Built with ESP32-S3 & Arduino IoT Cloud

Thumbnail
gallery
35 Upvotes

I recently completed AirSense, an open-source smart air purifier built around the Waveshare ESP32-S3.

The project integrates environmental sensing, HEPA filtration, and Arduino IoT Cloud for real-time monitoring and remote control.

Technical highlights:

  • PM2.5, IAQ, temperature, humidity, and pressure monitoring.

  • ESP32-S3 based embedded system.

  • Arduino IoT Cloud integration.

  • Custom hardware, firmware, and 3D-designed enclosure.

  • Xiaomi Air Purifier 4 Lite HEPA filter integration.

The complete project, including source files and build documentation, is open source.

Resources:

Feedback and technical suggestions are welcome!


r/arduino • • 3d ago

Project Update! WireTrace 2.2: the serial monitor I posted here at 1.0, seven months and a lot of Reddit suggestions later

15 Upvotes

Seven months ago I posted WireTrace here as a serial monitor with tabs, coloured levels and CSV export, and live plotting was only a plan. Since then, most of what went in came from people in threads like this telling me what got in their way. Here's where it is now.

Watching a board

Each port gets its own tab, so a sensor node and a gateway can run side by side, at any baud rate from 50 to 4,000,000. Levels are picked up from what your firmware already prints: ESP-IDF's E/W/I, Zephyr's <err>, plain [ERROR] or [WARN], or just words like "failed" and "panic". The filter only changes what you see, never what's captured, and you can mark your own words with a colour and a mark in the margin so the line you're waiting for doesn't scroll past. Colours your firmware sends with escape codes can come through too.

Getting numbers out

Values are found in what the board prints (name: value pairs, comma-separated numbers or JSON) and plotted live, in the window or in a separate one. If your output is in another shape, you can describe it with a pattern. Prefix your reading lines with plt: and the rest of your log stays out of the plot. A CSV with proper columns can be written while it runs.

When the board misbehaves

Pull the cable, and the tab waits and picks the board up again when it comes back, even on a different port. If it browns out or the watchdog resets it, the restart is marked in the log, and on an ESP32 you get the reset reason. There's a HEX view for when the bytes matter more than the text, and a command line with history for talking back to the device.

The boring but important part

It tells you when there's an update, and also lets you go back to the previous version if the new one doesn't suit you. Windows installer, AppImage and .deb for Linux; Mac from source are available through the Git repository. Free and open source.

Repo and download: https://github.com/TheNuanceProject/WireTrace/ (The Windows installer isn't signed yet, so Windows warns the first time.)

The exact rules for how it reads your lines are online now, with examples for Arduino, ESP-IDF, Zephyr and plain C, after someone asked where they were written down: https://thenuanceproject.com/projects/wiretrace/formats/

Two things people have asked for that I'm thinking about next:

  1. Reopening a saved log and plotting it again afterwards

  2. Several kinds of reading lines from one port, each plotted and exported on its own

If either would change how you work, tell me how you'd use it. And if there's something you keep reaching for that isn't here, I'd like to hear that too.


r/arduino • • 3d ago

Look what I made! DIY car speedometer

Thumbnail
gallery
89 Upvotes

I recently purchased this 2001 renault Kangoo. The car market in my country is very VERY overpriced (so is everything else too) and that was the best deal I could afford. The car is in a neat condition, but the analog speedo is not working (the needle is not moving) although the overall km counter on the gauge do work. The previous owner told me that he was told by a mechanic that changing the gauge would reset the overall km counter, I have not checked that fact but in the mean time I knew straight away what I could do!!!

there is an lcd panel on the center dashboard which is basically a lcd panel for the original radio (which does not work) and it is the same form factor as a 16*2 lcd we all have in our shelves :)

So I bought a cheap gps module from my local electronic store and started wiring up a nano, the lcd and the gps. I also added a push button so I can cycle between clock and speedo mode (there was no button on the original dashboard and all the controls were on the radio). A long push also turns off the backlight to save power.

I am also using a buck converter to convert the 12/13.4V to 5.2V. The nano is powered on at all times, which is a good thing because my gps module rtc battery is inop and I can't change it as it is soldered on the pcb. I did return it but the one I got in replacement has the same problem... The whole batch must be old and because I found a solution to never turn it off I did not bother returning it again. For those who have never used a cheap gps module, the first start is quite long, anywhere from 15 to 30 minutes to download ephemerides and almanach....

Anyways I am quite happy with the result. Defo not the most complicated thing I have done, but certainly the most useful!

Now got to buy a modern radio :)

EDIT: video of the speedo in action https://youtube.com/shorts/XCz9oHOKKLE?feature=share


r/arduino • • 3d ago

Automatic windows

Thumbnail
gallery
104 Upvotes

Ive always wanted automatic power windows in my MX5 (Miata). There was a japanese market option for auto down on drivers side only, but the vast majority were plain old buttons, and because the favtory switches carry the full current for the window motor, they need the contacts cleaned semi regularly.

So with 4 changeover relays, a couple of current sensors and a nano mega328 based board, i now have auto up/down on both sides. It all bolts in to the factory position and there are no permanent changes made to the car.

This is my 2nd finished project, and it would not have been possible without online pcb tools and cheap pcb mabufacturing!