/r/arduino

Photograph via snooOG

An unofficial place for all things Arduino!

We all learned this stuff from some kind stranger on the internet. Bring us your Arduino questions or help answer something you might know! 😉

/r/arduino

669,644 Subscribers

0

Any ideas how to mount the servo sideways?

https://preview.redd.it/7g8qfa1ltlwd1.jpg?width=2048&format=pjpg&auto=webp&s=0432c169a39f5e4b0e9246d5256b669aa4f1811c

Need this arduino project to open the lid, idk how to secure this servo in place, im thinking of just using zip ties but idk if it's going to be enough

4 Comments
2024/10/24
01:09 UTC

1

Connecting PS5 Controller to Arduino Nano Esp32

Hey everyone,

I'm new to all this stuff. I'm trying to connect a PS5 Controller to an arduino nano esp32. Is there any library available? Because I saw two libraries and tried them, but none really work. If not, is there another way for me to connect my controller to the microcontroller?

1 Comment
2024/10/24
00:51 UTC

0

Advice Needed: Building a Wearable Cattle Monitoring System with Arduino. How Difficult Would This Be?

Hey everyone!

I’m currently working on a project idea that I’d love some input on. The goal is to develop a wearable sensor system for cattle that can monitor their heart rate and location in real-time, sending this data to the cloud and making it accessible via a web/mobile app for farmers to monitor their livestock remotely. I've used the Arduino before for smaller scale projects and I really like it. I think its such a cool device and after following this subreddit for a while I think I have arduino-fever lmao

Here’s what I’m thinking the system would involve:

  • Heart Rate Sensor: Something small and non-invasive that can be worn on the cattle to track heart rate.
  • GPS Module: To track the cattle’s location within a geofence.
  • Microcontroller: I’m thinking of using an Arduino (probably something like an Arduino uno) to collect and transmit the sensor data.
  • Wireless Communication: Data would be sent to the cloud using LoRa, Wi-Fi, or GSM, depending on location/network availability.
  • Power Source: The system needs to run off a small battery (possibly with solar charging) and last for extended periods without maintenance.

The project’s goal is to make this as cost-effective as possible for small farmers who can’t afford high-end solutions. My background is in software, so I’m comfortable with coding the app and handling the cloud side of things, but hardware is pretty new to me.

My Questions:

  1. How feasible is this with Arduino components? I have a few sensors laying about somewhere that are made for arduinos. They were really cheap, so are there any you guys recomend for this project?
  2. Power management: What’s the best way to manage power for something that needs to run long-term in an outdoor environment?
  3. Signal transmission: Would LoRa be a good choice for sending data over long distances in rural areas, or would I be better off with GSM? What other challenges might I face here?
  4. Build complexity: How hard would it be to build and maintain a system like this? Any recommendations for components or tutorials that could help?

I’d really appreciate any advice or suggestions from anyone with experience in similar projects!
I should probably note that this project is just a proof of concept. I want to build it for a class in college. My uni has a bunch of parts for arduinos, which makes me want to use it even more. I would strap the device around their neck using a fabric strap and use a 3d printer to make the enclosure.

Thanks in advance!

5 Comments
2024/10/24
00:49 UTC

5

Controlling Stepper Motor with Arduino Nano Every

The other pcb on the breadboard is a TMC2209 stepper driver.

3 Comments
2024/10/24
00:21 UTC

1

Wifi for Arduino Uno r3

Hi guys, first time here. I'm very new to arduinos and i have to do a profejct for my uni where i got an arduino uno r3 and i need to connect it to a controller using wifi.

From what i gathered my arduino doesn't have inbuild wifi capabilities which is why i looked up potential hardware solutions. What i found is an arduino wifi shield but that isn't available on amazon in my country (should be bought from there because otherwise its a hassle with getting money back from my uni).

Are there easy alternatives or even better solutions for my problem? I really just need a very simple wifi connection so would an ESP32 or something be suitable?

Thanks :)

2 Comments
2024/10/24
00:04 UTC

1

SHT31 only outputting -45 C and 0 % RH

Hi, I have a SHT31 module connected to Uno clone. https://www.makerfabs.com/sht31-temperature-humidity-module.html

VIN to 5V
GND to GND
SCL/T to SCL
SAA/HR to SDA

Im using a sample code as below. What happens is that I only get -45 C and 0 % on the monitor, nothing else. Is my module broken or is there something else that can cause this? What happened is that I accidentally shorted all module pins together and then powered it.

If I unplug any wire of the module, there is nothing on the serial monitor, so atleast some life is present.

#include <Arduino.h>
#include <Wire.h>
#include "SHT31.h"

SHT31 sht31 = SHT31();

void setup() {  
  Serial.begin(9600);
  while(!Serial);
  Serial.println("begin...");  
  sht31.begin();  
}

void loop() {
  float temp = sht31.getTemperature();
  float hum = sht31.getHumidity();
  Serial.print("Temp = "); 
  Serial.print(temp);
  Serial.println(" C"); //The unit for  Celsius because original arduino don't support speical symbols
  Serial.print("Hum = "); 
  Serial.print(hum);
  Serial.println("%"); 
  Serial.println();
  delay(1000);
}



#include <Arduino.h>
#include <Wire.h>
#include "SHT31.h"


SHT31 sht31 = SHT31();


void setup() {  
  Serial.begin(9600);
  while(!Serial);
  Serial.println("begin...");  
  sht31.begin();  
}


void loop() {
  float temp = sht31.getTemperature();
  float hum = sht31.getHumidity();
  Serial.print("Temp = "); 
  Serial.print(temp);
  Serial.println(" C"); //The unit for  Celsius because original arduino don't support speical symbols
  Serial.print("Hum = "); 
  Serial.print(hum);
  Serial.println("%"); 
  Serial.println();
  delay(1000);
}

https://preview.redd.it/m4v8e2a14lwd1.jpg?width=1280&format=pjpg&auto=webp&s=4eeee54af9b8e3835cb4039e8dbbd5a63e4f5d63

0 Comments
2024/10/23
22:52 UTC

5

Why do i get these interferences?

I am using a 433mhz module. The idea is to turn on a buzzer from a distance. The Arduino here is only to provide battery. I think this is related to pull down or pull up resistance but I am really bad at understanding electronics. What can i do to avoid the buzzer turning on randomly?

10 Comments
2024/10/23
20:51 UTC

1

Stepper motor help

I'm making a Halloween prop and want a stepper motor to cause the roof of a dragon house to flap (see video: https://drive.google.com/file/d/1dsp30tsVrjba2RBIArAKJdtdsCZz3OMl/view?usp=drivesdk). I've currently got a Nema 23 rated at 2.2Nm 4a. As you can see from the video it's not able to lift the roof flap.

How might I get this to work? Bigger motor? Try a different power supply? Both? Change the cam dimensions? Etc.

I'm struggling to get this sorted. I really thought the current motor would be strong enough. Weight of each roof panel is approx 1kg +/- 100g.

14 Comments
2024/10/23
19:38 UTC

1

CH340G & ATMEGA328P Uno R3 Upload Error

I recently bought a cheap Arduino Uno R3 from AliExpress which had good reviews. Upon plugging it into my PC/Laptop, the PWR LED glows constantly, and the L LED blinks every ~1 second. My PC detects the board, as I have the driver installed, and I am able to successfully open a connection with a serial monitor.

However, when trying to upload from PlatformIO or the Arduino IDE, on both Windows and Linux, I am greeted by the same output:

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: 
PLATFORM: Atmel AVR (5.1.0) > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (avr-stub) External (avr-stub, simavr)
PACKAGES: 
 - framework-arduino-avr @ 5.2.0 
 - tool-avrdude @ 1.60300.200527 (6.3.0) 
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> 
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 5 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Checking size .pio/build/uno/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  10.0% (used 204 bytes from 2048 bytes)
Flash: [=         ]   6.7% (used 2174 bytes from 32256 bytes)
Configuring upload protocol...
AVAILABLE: arduino
CURRENT: upload_protocol = arduino
Looking for upload port...
Auto-detected: /dev/ttyUSB1
Uploading .pio/build/uno/firmware.hex
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

avrdude done.  Thank you.

*** [upload] Error 1

Whenever I plug the board in, open the serial monitor, or start uploading, I can see the L LED flashing quickly a few times, indicating that the board is resetting.

Another thing worth noting: Plugging in the Uno to my Windows PC, I see the reset flash repeat 6 times, whereas on my laptop running Arch, it happens only once. The same happens when trying to flash a bootloader.

I also tried connecting an LED via a 220 Ohm resistor to pin13 and ground, and it flashes like the builtin (kinda obvious, I know).

At this point, I'm out of ideas, I went through pretty much every link I could google, testing out solutions here and there, I've been through every conceivable driver I could find, yet nothing.

I can't post a link here, as my post keeps getting removed, but it's the cheapest and most generic black wifi board you can find on Ali.

As I am completely out of ideas, I'm hoping that one of you might be able to help me figure this one out... Any help is greatly appreciated!

6 Comments
2024/10/23
18:24 UTC

1

Problems with using ESP 01s

Hello everyone. I have a problem when I connect the ESP 01s through Arduino (bridging Recet) I can send the data without any problem. The real problem is when I try to use the USB to TTL, since in this case it doesn't work as it should because it doesn't let me send anything, maybe I missed one of the steps. By the way, so as not to make a mistake when bridging the pins, I created an adapter that allows me to pass the data with only 4 cables without having to bridge anything. I

https://preview.redd.it/x6s1jgfcgjwd1.jpg?width=1200&format=pjpg&auto=webp&s=8889dd9c0699f8222752e85b9e5f741e98fd9da7

https://preview.redd.it/h2w8hhfcgjwd1.jpg?width=1200&format=pjpg&auto=webp&s=e219affee1dad53b18f86c735e61f7f9ddac0f07

0 Comments
2024/10/23
17:11 UTC

0

Cant declare PID in library

im currently writing a library for a sensor but i cant seem to declare pids to use in multiple function of my library

https://preview.redd.it/2i9btwql1kwd1.png?width=907&format=png&auto=webp&s=62e3a3e45e1a26a6dd6407b6d6ce6771c0519d49

2 Comments
2024/10/23
18:12 UTC

1

PIR sensor can't reach HIGH with generic Nano clone

I have some simple code which uses a PIR sensor (HC-SR501) for motion detection:

int sensor = 2;  // PIR sensor pin
int val;

void setup() {
  Serial.begin(9600);     // For serial output
  pinMode(sensor, INPUT); // Set the sensor pin to input mode
  val = LOW;              // Initialize the sensor value to LOW
}

void loop() {
  // Read the value from the PIR sensor
  val = digitalRead(sensor);

  if( val == HIGH ) {
    Serial.println("Motion detected!");
    delay(5000); // Wait 5 seconds
  }
}

When I tried to run it on a generic Nano, it wouldn't detect any motion. After some testing, I discovered that the sensor's output pin was only reaching 2.2V when it went high, not enough to actually register as HIGH on the Nano. I tried it on two different Nanos and the result is the same. The setup looked like this:

PIR sensor connected to the Nano (D2, 5V, & GND)

Used the same sensor, same code on a different generic Uno R3, and it works fine. The output pin on thwe sensor goes to 3.3V when high, as expected.

PIR sensor connected to the Uno (D2, 5V, & GND)

Both boards are powered by the same USB port, and both show a steady 5.2V on the 5V pin. I'm wondering why this would happen so consistently with the Nano.

The sensor: https://www.amazon.com/HiLetgo-HC-SR501-Infrared-Sensor-Arduino/dp/B07KZW86YR/
The Nano: https://www.amazon.com/LAFVIN-Board-ATmega328P-Micro-Controller-Arduino/dp/B07G99NNXL/

0 Comments
2024/10/23
17:37 UTC

1

Verify my ATtiny85 is running on 1MHz? Switched from 8MHz to reduce current draw.

I am very new at this but I learned how to program my ATtiny85 with an UNO. I first burned the 8MHz boot loader by following this great video: https://www.youtube.com/watch?v=i9WOwDrpRKs&t=241s But now I want to do a test at 1MHz. I re-burned the boot loader at 1MHz but is there a way to make sure that I did it right? ChatGPT said to run the Blinky program and if it blinks in 1 second intervals then it's good, but I ran Blinky at 8MHz previously and it also blunk at 1 second intervals. Not sure if that's a valid test or not. You can see in the screenshot below that I chose 1MHz and then clicked on Burn Bootloader. The UNO blinked and it said it was complete. Hoping I did it right!

https://preview.redd.it/5mjpjgfsmjwd1.png?width=570&format=png&auto=webp&s=65804aa8bdca63ab6fe66f3a939be4a313b770b3

9 Comments
2024/10/23
17:48 UTC

1

Rookie in the field of iot need help wrt working with multiple sensors

IM USING multiple sensors modules dht22, mcp9808, bma456, sparkfun pulse oxymeter and heart rate monitor sensor module, seed studio xiao esp32s3

im not getting the hearte rate properly

and the output of this combo im not getting properly as pe defined interval

can you guys help and guide me with your expert knowledge

what should i do to work this combo properly or should change microcontroller board or sensor

Connection:

Circuit connection

Source Code :

#include <Wire.h>
#include <SparkFun_Bio_Sensor_Hub_Library.h>
#include <DHT.h>
#include "DFRobot_MCP9808.h"
#include "arduino_bma456.h"

// Variable to store step count
uint32_t step = 0;

// Pin definitions
const int resPin = 4;
const int mfioPin = 13;
const int dhtPin = 2;  // Change to the appropriate GPIO for ESP32

// Constants
const int SIZE = 6;
const int NUM_AVG = 5;
const int READINGS_PER_MINUTE = 6;
const int DELAY_BETWEEN_READINGS = 10000;
const int MINUTES_TO_STORE = 5;

// Heart rate data buffers
double currentHeartRates[READINGS_PER_MINUTE] = { 0 };
double avgHeartRates[MINUTES_TO_STORE] = { 0 };
int currentIndex = 0;
int avgIndex = 0;
bool averagesReady = false;

// Xyz temperature calculation variables
float xy = 37.0;
float v = 0.0;
float gf = 0.022;
float sg = 18.88;

// Sensor objects
SparkFun_Bio_Sensor_Hub bioHub(resPin, mfioPin);
DHT dht(dhtPin, DHT22);  // Initialize DHT11 on specified pin for ESP32
#define I2C_ADDRESS MCP9808_ADDRESS_7
DFRobot_MCP9808_I2C mcp9808(&Wire, I2C_ADDRESS);


// Function prototypes
float calculateAverage(double arr[], int size);

void setup() {
  Serial.begin(115200);
  Wire.begin();

  pinMode(resPin, OUTPUT);  // Initialize resPin as output

  // Initialize Bio Sensor
  int result = bioHub.begin();
  if (result == 0) {
    Serial.println("Sensor started!");
  } else {
    Serial.println("Could not communicate with the sensor!");
  }

  Serial.println("Configuring Sensor....");
  int error = bioHub.configBpm(MODE_ONE);
  if (error == 0) {
    Serial.println("Sensor configured.");
  } else {
    Serial.println("Error configuring sensor.");
    Serial.print("Error: ");
    Serial.println(error);
  }

  // Initialize the sensor
  if (!mcp9808.begin()) {  // Use the DFRobot MCP9808 initialization
    Serial.println("Couldn't find MCP9808! Check your connections and I2C address.");
    while (1)
      ;  // Halt if sensor initialization fails
  }
  bma456.initialize(RANGE_4G, ODR_1600_HZ, NORMAL_AVG4, CONTINUOUS);
  bma456.stepCounterEnable();



  // DHT11 initialization
  dht.begin();

  Serial.println("Loading up the buffer with data....");
  delay(1000);
}

void loop() {
  digitalWrite(resPin, HIGH);  // Turn pin on

  bioData body = bioHub.readBpm();  // Read heart rate from sensor
  double currentHeartRate = body.heartRate;

  if (currentHeartRate == 0) {
    delay(500);  // Wait for the next reading interval
    return;
  }

  // Store heart rate in buffer
  currentHeartRates[currentIndex] = currentHeartRate;
  currentIndex++;

  // If buffer is full, calculate and print the averages
  if (currentIndex >= READINGS_PER_MINUTE) {
    currentIndex = 0;  // Reset index for next minute

    // Calculate average heart rate
    double avgHeartRate = calculateAverage(currentHeartRates, READINGS_PER_MINUTE);

    // Shift values in avgHeartRates to the left and store the new average at the end
    for (int i = 1; i < MINUTES_TO_STORE; ++i) {
      avgHeartRates[i - 1] = avgHeartRates[i];
    }
    avgHeartRates[MINUTES_TO_STORE - 1] = avgHeartRate;
    avgIndex++;

    // Check if we have enough data to start calculating averages
    if (avgIndex >= MINUTES_TO_STORE) {
      averagesReady = true;
    }

    if (averagesReady) {
      // Calculate and update xyz temperature based on heart rate average
      float a1 = 4.5714;
      float b1 = 384.4286;
      float c1 = 7887.1;

      float a2 = 4.5714;
      float b2 = 384.4286;
      float c2 = 7899.76;

      // Calculate first four and second four average heart rates
      float firstFourAvg = calculateAverage(avgHeartRates, MINUTES_TO_STORE - 1);
      float secondFourAvg = calculateAverage(avgHeartRates + 1, MINUTES_TO_STORE - 1);

      // Compare the averages
      bool result = firstFourAvg > secondFourAvg;

      float hr, c;
      if (result) {
        hr = -a2 * (xy * xy) + b2 * xy - c2;
        c = (-2 * a2 * xy) + b2;
      } else {
        hr = -a1 * (xy * xy) + b1 * xy - c1;
        c = (-2 * a1 * xy) + b1;
      }

      float vdash = v + (gf * gf);
      float k = (vdash * c) / (vdash * (c * c) + (sg * sg));
      xy += k * (avgHeartRate - hr);
      v = (1 - (k * c)) * vdash;
    }

    // DHT11 readings
    float temperature_dht11 = dht.readTemperature();
    float humidity_dht11 = dht.readHumidity();
    float tempC = mcp9808.getTemperature();
    step = bma456.getStepCounterOutput();

    // Send the values to Serial Monitor
    Serial.print("HR:  ");
    Serial.print(avgHeartRate);
    Serial.print("   XY: ");
    Serial.print(xy);
    Serial.print("  BT: ");
    Serial.print(tempC);
    Serial.print("  Steps: ");
    Serial.println(step);

    Serial.print("  RT & RH :  ");
    if (isnan(temperature_dht11) || isnan(humidity_dht11)) {
      Serial.print("NaN,NaN");  // If DHT11 reading fails, send NaN
    } else {
      Serial.print(temperature_dht11);
      Serial.print(",");
      Serial.println(humidity_dht11);
    }
    Serial.println();
  }

  delay(DELAY_BETWEEN_READINGS);  // Delay before next reading
}

// Function to calculate average
float calculateAverage(double arr[], int size) {
  float sum = 0;
  for (int i = 0; i < size; ++i) {
    sum += arr[i];
  }
  return sum / size;
}
0 Comments
2024/10/23
16:11 UTC

3

Trouble reading accelerometer

I flagged this as "hardware help", but this may be a software issue.
I'm trying to read an ADXL345 accelerometer over 3-wire SPI, but I keep getting "-1, -1, -1" despite lots of motion. I've tried a couple of example sketches and run into the same issue. I need SPI communication for the speed (otherwise I'd use the I2C quick connector). What's going on? Thanks in advance! I'm using a Seeed Studio ESP32-C3. Details:

ADXL SDA to XIAO D18 (MOSI)
ADXL SCL to XIAO D8 (SCK)
ADXL CS to XIAO D1 (I've tried the GPIO: "3", label: "D1", and "1" in the code)
Powering the ADXL from 3v3 (lists 3-5v range)

Code:

#include <SparkFun_ADXL345.h>  // Include the ADXL345 library

// Initialize the ADXL345 object for SPI communication
ADXL345 adxl = ADXL345(9);  // Use GPIO 9 as the CS pin (modify this if needed)

void setup() {
  Serial.begin(9600);  // Initialize serial communication at 9600 baud

  adxl.powerOn();      // Power on the ADXL345 sensor

  adxl.setRangeSetting(2);  // Set accelerometer range to ±2g
  adxl.setSpiBit(1);        // Set to 3-wire SPI mode
}

void loop() {
  int x, y, z;  // Variables to store the XYZ values

  adxl.readAccel(&x, &y, &z);  // Read the XYZ values from the accelerometer

  // Output the values to the serial monitor

  Serial.print(x);

  Serial.print(y);

  Serial.println(z);

  delay(100);  // Add a short delay for readability
}
0 Comments
2024/10/23
16:24 UTC

0

Can I use a toggle switch and relay to switch between dual power sources on my project?

Hi yall,

I'm building a personal project for the first time, and I was wondering if I could use an SPDT toggle switch and relay to switch between two power sources.

I'm building a smart safe with an ESP32 wroom board, fingerprint scanner, keypad, OLED display, ultrasonic sensor as a motion sensor, buzzer, LEDs, and a solenoid as the locking mechanism. The main power source for the project is a DC power jack and a 9V AC DC power supply adapter (but I think I need more than 9V; I'm not 100% sure yet). I took inspiration from this project online but wanted to add more components.

I want to implement a battery backup system in case there is a power outage and need a second power source. I was thinking of using a 9V lithium battery and a battery clip connector connected at all times then using a toggle switch and relay or transistor to switch power sources in code.

Is it possible to have dual power sources but only one running at a time (I'm afraid of blowing up my circuit)? Also, is it possible to switch between two power sources without manually switching them?

I'm such a newbie, I'll take any suggestions!

this is the circuit I'm taking inspiration from:

https://preview.redd.it/e4k7jtnw8jwd1.png?width=915&format=png&auto=webp&s=8515f16a4925f79c4c969d183f8f22d1dfd3ba8d

2 Comments
2024/10/23
16:22 UTC

1

Arduino power to Breadboard

Hello, I am working on a project due very soon so time is of the essence. I have 2 DC motors that are powered by a 7v battery pack, and I want to remotely activate the DC motors via IR on an Arduino. Is there a way I can use the Arduino to toggle power on and off to the DC motors without any fancy hardware. (I would use a l298n technically but my question is more about how I can use an Arduino to toggle power to something powered externally) Any help would be appreciated! :)

2 Comments
2024/10/23
15:35 UTC

0

Making the LED show the POT value when you twist it and switching back to temperature value 10 seconds after.

Hi, what im failing to do is already in the title, everything else works fine but i cant manage this at all. What im trying to make is basically a termostat. Any help would be much apriciated!! (im very much a beginner)

https://preview.redd.it/t05v8pifyhwd1.png?width=1050&format=png&auto=webp&s=84190632c60a102a18846b8d969e67b99f6d29b0

// C++ code

//

#include "Adafruit_LEDBackpack.h"

int Draaiknop = 0;

int Temperatuur = 0;

int Potentiometer = 0;

Adafruit_7segment led_display1 = Adafruit_7segment();

void setup()

{

pinMode(A0, INPUT);

pinMode(A1, INPUT);

pinMode(13, OUTPUT);

led_display1.begin(112);

pinMode(12, OUTPUT);

Serial.begin(9600);

}

void loop()

{

Potentiometer = analogRead(A0);

Temperatuur = (-40 + 0.488155 * (analogRead(A1) - 20));

Draaiknop = map(Potentiometer, 0, 1023, 0, 85);

// LAMPJES

if (Draaiknop < 5 || Draaiknop > 80) {

digitalWrite(13, LOW);

led_display1.setBrightness(0);

digitalWrite(12, LOW);

} else {

led_display1.setBrightness(15);

if (Draaiknop == Temperatuur) {

digitalWrite(13, LOW);

digitalWrite(12, LOW);

}

if (Draaiknop > Temperatuur) {

digitalWrite(13, HIGH);

digitalWrite(12, LOW);

}

if (Draaiknop < Temperatuur) {

digitalWrite(13, LOW);

digitalWrite(12, HIGH);

}

}

led_display1.println(Temperatuur);

led_display1.writeDisplay();

Serial.println(Draaiknop);

delay(10); // Delay a little bit to improve simulation performance

8 Comments
2024/10/23
12:09 UTC

1

What to study next?

Hi guys,
I'm an electronics noob. I have a project in my mind... my mum and I have a small gardening plot with a very shallow water well and a 1000 liters water tank, I'd like to program an Arduino, connected to two sensors (well and tank) and to a relay to turn on a pump whenever there is water in the well and the tank is not full. Already written a c++ "simulator" with realistic parameters (well fill rate, pump rate given the difference in height between the water surface and the tank... it should work). Everything should be powered by a PV module + 12V battery. The problem is, I really don't have any experience with Arduino, with electronics or with PV panels... so I have some options at hand... for the arduino part, I think I'm going to follow a YT arduino and "electronics for makers" video course from an italian engineer. And apart from that, i could:
-Read "Practical electronics for inventors"
-Read an electrotecnics school book that I have at home, I think written more for electricians
-Read "Solar electricity handbook", for the PV part
-"Off grid solar power simplified"
-Electrician's handbooks to focus on safety?
-NEETS navy manuals for the wiring part? I see some people have a good opinion about them
What should I prioritize?
Math and programming are not a problem for me... but I don't know anything practical about wiring, electronics and so on... and I want everything to be as safe as possible, there are trees nearby and I don't want things to catch fire or something... thanks for help!

1 Comment
2024/10/23
09:58 UTC

1

Hand motion capture

I know there exists device's which can track the motion of a hand/fingers but I want to learn how to make something like that.

My question now is, are there any sensors which could be used to detect finger/hand movements which are small enough?

0 Comments
2024/10/23
10:18 UTC

1

ESP32-C3 and Azure Device Update

I'm wanting to utilise azure device update service for my esp32-c3. I've come across this github repo: https://github.com/Azure-Samples/iot-middleware-freertos-samples/tree/main/demos/projects/ESPRESSIF/adu which offers in depth guide on how to integrate the freertos with esp32. But esp32-c3 has a smaller flash storage than esp32, and I can't flash it. Does anyone know if I can do anything with the partition sizes on the esp32-c3 to accomodate for the freertos image?

0 Comments
2024/10/23
08:02 UTC

3

I don't understand how to connect swishes in a good way.

I have recently started a project where i need 6 switches connected to a Arduino. But I am having trouble connecting them in a good way. This is what i have so far:

https://preview.redd.it/s1ky4wlrsgwd1.png?width=2233&format=png&auto=webp&s=27061c49cc59b643b35d2ea03acfaeed7db91982

but when i switch on one of the swishes it changes the read on all the pins:

https://preview.redd.it/renm78hysgwd1.png?width=2171&format=png&auto=webp&s=5d103738004ac39825e255be86b87986c33cc0d5

I don't understand why they would effect each other through the diodes.
Also if this is close to right, what type of diode works best for this type of application?

Edit: I needed to use resistors instead of diodes. (It works now)

8 Comments
2024/10/23
08:19 UTC

1

Arduino simulation software? Recommendation?

Is there software where I can simulate as if I used XYZ module with an arduino and installed code etc?

Would be very very convenient...

(Needed for uni project).

2 Comments
2024/10/23
07:35 UTC

2

Recommendations for replacing ethernet cables with wireless

I'm looking for some guidance on which wireless method you think would be best suited for a project.

I do cowboy fast draw competitions (shooting wax bullets), and each 1/8" steel plate target has a sensor behind it that is connected via cat5 to a timer device. There is 1 sensor and 1 timer for each target. I want to replace the ethernet portion because we use up to 8 targets at a time and it all has to be setup/taken down every day we shoot, and if we can avoid dealing with cables, that'd be fantastic.

The furthest target is about 50 feet from its timer, which displays in milliseconds.

This won't be my first arduino project, but it will be the first time I've used any sort of wireless comms. What do you all think I should use? Bluetooth? Performance is more important than cost.

I'd like to do this using nano's on both ends.

7 Comments
2024/10/23
07:09 UTC

3

Why does enabling I2C cause my servos to stop working?

10 Comments
2024/10/23
05:05 UTC

2

Smart Farming System

Hi there! I'm currently working on a project to simulate, model, and build a smart farming system using an Arduino Uno, a soil moisture sensor, an LM35 temperature sensor, and a GPRS module. The system will include an LCD screen to display sensor readings. The main objectives are to supply water when the soil moisture is low and to activate a fan if the temperature becomes too high. I'm feeling a bit lost on how to proceed with this project and would greatly appreciate any guidance or help you could provide. Thank you!

1 Comment
2024/10/23
02:04 UTC

1

Arduino showing random characters

hello,

I'm pretty new to Arduino, and there's a weird thing happening with my board.

I'm using an Arduino Uno, and an HX711 extension.

code:

#include "HX711.h"

// HX711 circuit wiring

const int LOADCELL_DOUT_PIN = 5;

const int LOADCELL_SCK_PIN = 4;

HX711 scale;

void setup() {

Serial.begin(57600);

scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);

}

void loop() {

if (scale.is_ready()) {

long reading = scale.get_units(20);

Serial.print("HX711 reading: ");

Serial.println(reading);

} else {

Serial.println("HX711 not found.");

}

delay(1000);

}

output:

���f�����`x��f��`��怘�`��怘���f��`��怘����f�����`x��f��`��怘����f�����`x��f��`��怘����f�����`x��f��`��怘����f�����`x��f��`��怘�g-�g,�e��f_�g-�F��F��f��g-�FR�F��f��G��f��f��g��g,�f�g,�f_�f��gŅf_�F��g��fF�F��F��f��G��F�‘�f�����`x��f��`��怘�g,�fW�F��g��e��F��f��g-�F��f��G��fU�F��f��g��f��f��F��F��F��F��f��f��g
�F��f��fU�F��g-�fU�F��f��G��F��f��g
�....

does anyone know why? It doesn't matter whether I wire the HX711 or not, and the board seems to be working fine, until i use the scale.is_ready() function.

3 Comments
2024/10/22
23:45 UTC

Back To Top