Mat Pike
Published © CC BY

Row Counter for Sentro Knitting Machine

The Sentro knitting machine is a modern marvel but its row counter might as well be non-existent, this electronic counter fixes that

BeginnerShowcase (no instructions)2 hours160
Row Counter for Sentro Knitting Machine

Things used in this project

Hardware components

Wemos D1 Mini
Espressif Wemos D1 Mini
×1
Duinotech Arduino Compatible Hall Effect Sensor
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Basic Diagram

Sensor connected to +5V, GND and D2

Code

Arduino Code

Arduino
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>

const char* ssid = "SSID_XXXX";
const char* password = "PASSWORD_XXXX";

// Initialize Hall effect sensor on pin D2
const int hallSensorPin = D2;
int magneticFieldCount = 0;

ESP8266WebServer server(80);

void handleRoot() {
  server.send(200, "text/plain", "Magnetic field count: " + String(magneticFieldCount));
}

void setup() {
  pinMode(hallSensorPin, INPUT_PULLUP);
  Serial.begin(115200);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi...");
  }
  Serial.println("WiFi connected!");
  server.on("/", handleRoot);
  server.begin();
}

void loop() {
  if (digitalRead(hallSensorPin) == LOW) {
    // Hall effect sensor detected a magnetic field
    magneticFieldCount++;
    delay(1000); // Debounce delay
  }
  server.handleClient();
}

Credits

Mat Pike
5 projects • 3 followers
Studying electrical engineering

Comments