logo elektroda
logo elektroda
X
logo elektroda

RPM counter from Arduino to ESP with Hall sensor A3144 display ; LM393

sznickers 435 20
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 21404038
    sznickers
    Level 11  
    Hello,
    A colleague Waldek has made a cool RPM counter on an Arduino using an A3144 Hall sensor with software.
    The video is on YT
    https://www.youtube.com/watch?v=nO3DbYL_3vQ&a...vNgj2g_rZfk9Tht4AaABAg.994sViAIPI9ADUeQknJiDE
    My question is, as I am currently relying on ESP, is it possible to upload this soft to ESP in some non-difficult way? Either in "rules" or as a script in domoticz. There are LUA, dz vents, blockly, python scripts in domoticz. Is it possible to convert this in some easy way ? If not I will do it on Arduino and somehow try to connect to Domoticz.
    batch to arduino:

    Code: C / C++
    Log in, to see the code
    .

    Added after 4 [minutes]: .

    I also bought a : Hall sensor module hall sensor A3144 Arduino, but without scripting - which I am poor at - is it possible to get a measurement of the number of revolutions ? In combination with ESP
    Hall sensor module A3144 for Arduino
  • ADVERTISEMENT
  • Helpful post
    #2 21404166
    iftri
    Level 19  
    Code for ESP
    Code: C / C++
    Log in, to see the code
    .

    And to house

    Code: C / C++
    Log in, to see the code
  • #3 21404337
    sznickers
    Level 11  
    thank you Iftri, as I upload, check, let me know, I will order the components on ali.
  • #4 21405428
    sznickers
    Level 11  
    I've uploaded the soft on ESP8266 but I see it's cramped :) -waiting for ESP32
    ESP Easy Mega user interface with code exceeding text limit. .
  • ADVERTISEMENT
  • #5 21406001
    sznickers
    Level 11  
    Configuration screen view with sensor settings, including pulse counter and analog input. .
    I'm trying to think the other way, I have this ready-made module with Hall sensor: A3144E, Comparator: LM393, Signal: digital, analogue. I don't know how to set, because count, total and time nothing changes.
    Screenshot of ESP Easy Mega device configuration with pulse counter settings. .

    Added after 6 [hours] 42 [minutes]: .



    .
    Hall sensor module A3144E and microcontroller board connected with wires. .
    Electronic circuit with Hall sensor A3144E and comparator LM393. .
    I managed to get it to work. I don't know what the "Time" is for, whether to use it and how. Surely the correct mounting of the magnet in relation to the sensor is important. It works.
  • ADVERTISEMENT
  • #6 21416018
    sznickers
    Level 11  
    I got the display, connected the Hall sensor, uploaded the revised software to the ESP. I uploaded it to the ESP32 and it doesn't work - i.e. it doesn't display RPM etc on the display.



  • #7 21416080
    iftri
    Level 19  
    Can you see anything on the display, does it light up maybe you need to tune the contrast, What pins is it connected to on the ESP 32 (SDA - default GPIO21, SCL - default GPIO22)? This display is not on 5v? The Esp32 gives 3v3,.
  • ADVERTISEMENT
  • #8 21416089
    sznickers
    Level 11  
    I checked the display by displaying the measurements of other sensors [....#...]. I adjusted the contrast. I connected the display (power) to the 5v pin naturally it's VIN (because I switched to ESP32W32room board) or VBUS for esp32S2 mini . SDA SCL as in the picture
    ESP Easy Mega configuration screen with device and GPIO settings. .
  • #10 21416616
    sznickers
    Level 11  
    Are you saying to connect SCL, SDA under GPIO21,22 ? There is an option to connect under several different pins these channels and so I did. Do you think that if I change to these pins it will be ok ?
  • Helpful post
    #11 21416629
    iftri
    Level 19  
    These pins are the default, for those to work you need to set them in the code.
  • Helpful post
    #12 21416663
    starob
    Level 29  
    sznickers wrote:
    doesn't work-i.e. doesn't display RPM etc.


    @sznickers again you are trying to conflate two different "currency systems".
    You are trying to run an arduino program in RULES espeasy. RULES is an internal interpreter created for espeasy and is like its own programming "language".
    Mixing ingredients like this is only good for cooking bigos :) .

    ... you either upload a pure .ino ...or espeasy and a proper rules script.

    https://www.letscontrolit.com/forum/viewtopic.php?t=3476&start=10

    As usual - documentation and google "espeasy rpm meter"
  • #13 21416711
    sznickers
    Level 11  
    oldob thanks, I'm happy to listen to your comments, you have the knowledge and experience and I'm a simple mechanic :) (not the automotive one). I'd be happy to rework that lesson from letscontrolit.
    The iftri I changed the SCL and SDA pins to 21 and 22, but it didn't go either. The display lights up, but only in green.
    Screenshot of the ESP Easy Mega interface showing a device list with names, ports, and GPIO values. .
  • #14 21416730
    starob
    Level 29  
    sznickers wrote:
    Display lights up, but only in green.


    The I2C bus always requires 2 external pull-up resistors for the SDA and SCL lines.
    Perhaps, it is sufficient for the GPIO to include an internal pullup? (most "tutorials" only use internal").
    First run the display itself by uploading some arduino demo, when you are sure that the hardware works well - upload espeasy.
  • #15 21416735
    iftri
    Level 19  
    Turn the contrast potentiometer on the display
  • #16 21416743
    sznickers
    Level 11  
    Screenshot of ESP Easy Mega settings on the Devices tab with configuration for a pulse counter. .
    I changed to pull up, also nothing. The display works because I tested it on a different script, when I turn ESP on or off it says ESP Easy.

    Added after 3 [minutes]: .


    LCD display showing values: 3158 W and 9.051/min, connected to a Siemens device. .

    when switching on the LUA script from domoticz from other sensors it works nicely
  • #17 21416752
    starob
    Level 29  
    sznickers wrote:
    when I switch ESP on or off the text ESP Easy appears.

    So much good :)
    tip... In espeasy there is in tools > interfaces > I2c scanner, allows you to check if the device is detected.
    What are you trying to display and how?... because I don't really believe you've already dealt with the rules. More info!
  • #18 21416781
    sznickers
    Level 11  
    Yeah, there's such a tool, I'm getting it :)
    Screenshot of the ESP Easy Mega user interface showing used I2C addresses and supported devices.
    Screenshot of the ESP Easy Mega interface with the Devices tab showing a list of tasks and devices. .
    it's about the script I uploaded to Rules, a colleague iftri made a change of this script from arduino to esp, I uploaded it to rules and it doesn't hula

    Added after 5 [minutes]:

    I came up with the idea of how to do it in domoticz and then send the measurement to esp32, but the whole issue was to eliminate the middleman which is raspberry, wifi etc, and to raspberry possibly I could have the measurements and register coming in. But cool, as if it would work, unless I upload this Arduino script to the esp and it would too, then instead of the esp easy what application, program do I need to install to get it on the Arduino ? Because i understand that you can upload arduino to esp.
  • Helpful post
    #19 21416795
    iftri
    Level 19  
    You can upload to esp32 from Arduino Ide, compile and upload, beforehand you have to prepare Arduino Ide under ESP32
  • #20 21416796
    starob
    Level 29  
    sznickers wrote:
    mate iftri made a change to this script from arduino to esp, I uploaded it to rules and it doesn't hula


    You don't even read (or understand) what I wrote! What @iftri did is an arduino script to upload directly to the ESP instead of espeasy.
    Uploading it to rules won't work because espeasy doesn't understand it.

    Again, use this tutorial and don't mix two different solutions.
    https://www.letscontrolit.com/forum/viewtopic.php?t=3476&start=10

    p.s. I am still reviewing your pics.
    Which sensor signal, A or D do you have connected to the GPIO of the esp? (Because you have cables on both).
    When you spin that magnet does your DOUT LED blink?

    I ask this for future reference :) .
  • #21 21418217
    sznickers
    Level 11  
    On the hall module, I have the signal cable connected to D0 and the ESP counts the number of revs and the number of rpm --> yes +/- because it obviously still needs to be calibrated. The LED on the hall module when I apply a magnet or a fan with a magnet blinks, yes or lights up continuously as there are revs.

Topic summary

The discussion centers on adapting an Arduino-based RPM counter using an A3144 Hall sensor and LM393 comparator for use with ESP microcontrollers, specifically ESP8266 and ESP32, with display output on an I2C LiquidCrystal LCD. The original Arduino code was modified for ESP8266, successfully displaying RPM and a bar graph on a 16x2 LCD. Challenges arose when porting to ESP32, including display initialization issues, I2C pin configuration (default GPIO21 for SDA and GPIO22 for SCL), and ensuring proper pull-up resistors on the I2C bus. The user experimented with wiring and contrast adjustments, confirming the Hall sensor module's LED output blinking with magnet rotation, indicating signal detection. It was clarified that Arduino sketches can be uploaded directly to ESP devices via the Arduino IDE configured for ESP32, but the Arduino code cannot be run directly within Domoticz rules or ESPEasy rules due to incompatible scripting environments. The recommendation is to either run the Arduino sketch natively on the ESP or use ESPEasy with its own rules language. The user also considered integrating measurements into Domoticz but aimed to avoid intermediary devices like Raspberry Pi. The importance of correct sensor wiring, magnet placement, and calibration was emphasized for accurate RPM measurement.
Summary generated by the language model.
ADVERTISEMENT