/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

655,997 Subscribers

1

Looking for Ultra-Sensitive, Force resistive sensors- Any Recommendations?

I'm working on a project that requires a very sensitive sensor capable of detecting even slight changes in touch pressure. Ideally, I'm looking for a force resistive sensor, but I'm open to other types of sensors that can perform the same functionality and are flexible. 🤖

Does anyone have recommendations on where to find such a sensor? Any specific brands or models that you've had good experiences with? Online stores or specific suppliers would be greatly appreciated! 🙏

Thanks in advance for your help! 😊

0 Comments
2024/07/26
12:15 UTC

1

Help My Micromouse isn't going straight and not going straight in between walls. code is given below.

I made a micromouse by two perfboards iam using 3 HCSR04 to sense objects in left,front,right of the mouse using two n20 gear motor with encoders, l298n H-bridge arduino uno and 2 3.7V Li ion battery size of the mouse is 10*10 cm .walls are 17*17cm ,the problems with the mouse are :

1.when the two motors are at same speed and moving in same direction ,mouse is not going straight u can see in video its going towards right the code is given below:

2.I wrote enough code to sense obstacles around mouse and calibrate it to travel through the way between the walls (in code i wrote when >58000 return 0 because at very close when sensors can't recieve sended signal returning a default value>58000)

problem1 & 2

MOUSE

plz help

prbolem1_code:

'''

#define ENA 10
#define IN1 9
#define IN2 8
#define IN3 13
#define IN4 12
#define ENB 11



void setup() {
  // put your setup code here, to run once:
pinMode(ENA,OUTPUT);
pinMode(IN1,OUTPUT);
pinMode(IN2,OUTPUT);
pinMode(IN3,OUTPUT);
pinMode(IN4,OUTPUT);
pinMode(ENB,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  analogWrite(ENA,255);
  analogWrite(ENB,255);


  digitalWrite(IN1,HIGH);
  digitalWrite(IN2,LOW);
  digitalWrite(IN3,LOW);
  digitalWrite(IN4,HIGH);

  delay(10000);

  digitalWrite(IN1,LOW);
  digitalWrite(IN2,LOW);
  digitalWrite(IN3,LOW);
  digitalWrite(IN4,LOW);
  delay(1000);
}

'''

problem2_code:

'''

#define ENA 10

#define IN1 9

#define IN2 8

#define IN3 13

#define IN4 12

#define ENB 11

#define RIGHT 1

#define LEFT -1

int frontTrig = A3, frontEcho = A2;

int leftTrig = A0, leftEcho = A1;

int rightTrig = A5, rightEcho =A4;

// int frontTrig = 4, frontEcho = 5;

// int leftTrig = 7, leftEcho = 6;

// int rightTrig = 2, rightEcho = 3;

long front,left,right;

const byte power=180;

int targetFront;

int thresholdFront;

int targetSide;

int thresholdSide;

void configure(){

pinMode(frontTrig, OUTPUT);

pinMode(leftTrig, OUTPUT);

pinMode(rightTrig, OUTPUT);

pinMode(frontEcho, INPUT);

pinMode(leftEcho, INPUT);

pinMode(rightEcho, INPUT);

}

void forward(){

analogWrite(ENA,power);

analogWrite(ENB,power);

digitalWrite(IN1,HIGH);

digitalWrite(IN2,LOW);

digitalWrite(IN3,LOW);

digitalWrite(IN4,HIGH);

}

void stop(int time=500){

digitalWrite(IN1,LOW);

digitalWrite(IN2,LOW);

digitalWrite(IN3,LOW);

digitalWrite(IN4,LOW);

delay(time);

}

void sense(){

digitalWrite(frontTrig, LOW);

delayMicroseconds(2);

digitalWrite(frontTrig, HIGH);

delayMicroseconds(10);

digitalWrite(frontTrig, LOW);

front = pulseIn(frontEcho, HIGH);

delay(1);

if(front>58000)

front=0;

delay(1);

// Measure left distance

digitalWrite(leftTrig, LOW);

delayMicroseconds(2);

digitalWrite(leftTrig, HIGH);

delayMicroseconds(10);

digitalWrite(leftTrig, LOW);

left = pulseIn(leftEcho, HIGH);

delay(1);

if(left>58000)

left=0;

delay(1);

// Measure right distance

digitalWrite(rightTrig, LOW);

delayMicroseconds(2);

digitalWrite(rightTrig, HIGH);

delayMicroseconds(10);

digitalWrite(rightTrig, LOW);

right = pulseIn(rightEcho, HIGH);

delay(1);

if(right>58000)

right=0;

delay(1);

}

void initialize(){

sense();

}

void setup() {

// put your setup code here, to run once:

pinMode(ENA,OUTPUT);

pinMode(IN1,OUTPUT);

pinMode(IN2,OUTPUT);

pinMode(IN3,OUTPUT);

pinMode(IN4,OUTPUT);

pinMode(ENB,OUTPUT);

configure();

delay(5000);

calibrate();

forwardWhiskers();

}

void loop() {

}

void calibrate(){

initialize();

initialize();

initialize();

targetSide=(left+right)/2;

targetFront=targetSide;

thresholdSide=(targetSide+front)/2;

thresholdFront=(targetFront+front)/2;

}

void forwardWhiskers(){

while(front>targetFront){

sense();

if(left<thresholdSide && right<thresholdSide){

forwardProportional(right-left);

}

else if(right<thresholdSide)

forwardProportional(right-targetSide);

else if(left<thresholdSide)

forwardProportional(targetSide-left);

else

forward();

}

stop();

}

void forwardProportional(int error){

float kp=2;

int powerLeft = power + kp * error;

int powerRight = power - kp * error;

analogWrite(ENA, constrain(powerLeft, 100, 255));

analogWrite(ENB, constrain(powerRight, 100, 255));

digitalWrite(IN1,HIGH);

digitalWrite(IN2,LOW);

digitalWrite(IN3,LOW);

digitalWrite(IN4,HIGH);

}

'''

0 Comments
2024/07/26
06:40 UTC

1

simple project idea that can solve a problem in the community

hello! i’m a high school student and our teacher is requiring us to do a bot that can solve an issue / problem in the community. we have done an automatic trashcan previously however our teacher told us that it was too simple and we needed to add features to it. our main issue is that we have no idea what other projects are doable with our resources and coding ability (not that good) that can impress our teacher and can solve a problem in the community. thank u so much for any suggestions!

0 Comments
2024/07/26
13:32 UTC

8

These 3D printer panels are pretty neat if you need a display, buzzer, rotary button, and removable storage solution (feat. MINI12864 ESP32)

1 Comment
2024/07/26
13:01 UTC

1

How can I achieve extremely regular pulses?

I am trying to make a neopixel strip flash in time the the beat of music. I manually check the song BPM, then input it using a rotary encoder, and time the beat by pressing a button on the beat to reset the pulse timing. The problem is the flashes always end up out of sync. Is there a more accurate way I can get the pulses to occur every x milliseconds? Here's my code:

#include <FastLED.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <TimerOne.h>

#define NUM_LEDS 144
#define DATA_PIN 8
#define BUTTON_PIN 4
#define ENCODER_CLK 2
#define ENCODER_DT 3
#define OLED_RESET -1
#define SCREEN_ADDRESS 0x3C
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 32

const CRGB LED_COLOR = CRGB(0, 255, 0);  // Green color
const int BRIGHTNESS = 100;  // Adjust this value to set the brightness
int FADE_SPEED = 40;  // Adjust this value to change the fading effect

CRGB leds[NUM_LEDS];
volatile int bpm = 120;  // Initial BPM value
volatile bool triggerFlash = false;  // Flag to trigger LED flash

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

unsigned long lastDebounceTime = 0;
const unsigned long debounceDelay = 50;
int buttonState;
int lastButtonState = LOW;
volatile int lastClkState;
volatile bool bpmChanged = false;
volatile unsigned long lastFlashTime = 0;
volatile unsigned long flashIntervalMicros = 0;

void setup() {
  pinMode(BUTTON_PIN, INPUT);
  pinMode(ENCODER_CLK, INPUT);
  pinMode(ENCODER_DT, INPUT);

  lastClkState = digitalRead(ENCODER_CLK);

  attachInterrupt(digitalPinToInterrupt(ENCODER_CLK), updateEncoder, CHANGE);
  attachInterrupt(digitalPinToInterrupt(ENCODER_DT), updateEncoder, CHANGE);

  FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
  FastLED.setBrightness(BRIGHTNESS);
  FastLED.clear();

  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;);
  }

  display.display();
  delay(2000);
  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0, 10);
  display.print("BPM:");
  display.display();

  displayBPM();
  updateTimerInterval();

  Timer1.initialize();
  Timer1.attachInterrupt(timerIsr);
}

void loop() {
  unsigned long loopStartTime = micros();  // Record the start time of the loop

  if (bpmChanged) {
    displayBPM();
    updateTimerInterval();
    bpmChanged = false;
  }

  int reading = digitalRead(BUTTON_PIN);

  if (reading != lastButtonState) {
    lastDebounceTime = millis();
  }

  if ((millis() - lastDebounceTime) > debounceDelay) {
    if (reading != buttonState) {
      buttonState = reading;
      if (buttonState == HIGH) {
        Timer1.stop();
        lastFlashTime = micros();
        updateTimerInterval();
        Timer1.start();
      }
    }
  }

  lastButtonState = reading;

  if (triggerFlash) {
    triggerFlash = false;
    startNewEvent();
  }

  updateLEDs();
  FastLED.show();

  unsigned long loopEndTime = micros();
}

void startNewEvent() {
  fill_solid(leds, NUM_LEDS, LED_COLOR);
}

void updateLEDs() {
  fadeToBlackBy(leds, NUM_LEDS, FADE_SPEED);
}

void displayBPM() {
  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0, 10);
  display.print("BPM: ");
  display.print(bpm);
  display.display();
}

void updateTimerInterval() {
  flashIntervalMicros = 60000000UL / bpm;  // Base interval in microseconds
  unsigned long currentTime = micros();
  unsigned long elapsedTime = currentTime - lastFlashTime;  // Time since last flash
  unsigned long adjustedInterval = flashIntervalMicros > elapsedTime ? flashIntervalMicros - elapsedTime : flashIntervalMicros;

  Timer1.setPeriod(adjustedInterval);
}

void timerIsr() {
  unsigned long currentTime = micros();
  lastFlashTime = currentTime;
  triggerFlash = true;
}

void updateEncoder() {
  int clkState = digitalRead(ENCODER_CLK);
  int dtState = digitalRead(ENCODER_DT);

  if (clkState != lastClkState) {
    if (dtState != clkState) {
      bpm = constrain(bpm + 1, 60, 200);
    } else {
      bpm = constrain(bpm - 1, 60, 200);
    }
    bpmChanged = true;
  }

  lastClkState = clkState;
}
1 Comment
2024/07/26
12:35 UTC

7

My first real Arduino project - stepper motor controller for an equatorial platform for a dobsonian telescope

2 Comments
2024/07/26
12:07 UTC

1

7.4v lipo direct to Arduino nano vin?

Can I run 7.4v lipo feed direct to the breadboard next to the vin pin and ground pin on a Arduino nano?

2 Comments
2024/07/26
11:47 UTC

15

Possible to make a tool to ring restaurant pagers?

Hello all, a friend of mine used to rent out a restaurant and left these pagers laying around, before selling them, I’d like to experiment with them and try to “hack” them while they are mine and it’s legal.

Is it possible to make a device with the Arduino to ring them all?

I have access to arduinos such as the UNO, and a few others. I also have a rf module 433mhz (comes with transmitter and receiver) is it possible to make a tool that will ring all the restaurant pagers?

If anyone has any advice, feel free to post it down below, I’d really appreciate it!

7 Comments
2024/07/26
11:18 UTC

1

How to set SPI2 pins? - error 'SPI' does not name a type

Hi, I am trying to use SPI2 pins using code below and I get the error Compilation error: 'SPI' does not name a type; did you mean 'SPI1'? Using ArduinoIDE and have STM32duino core boards installed.

#include <SPI.h>
SPI.setMOSI(PB15);
SPI.setMISO(PB14);
SPI.setSCLK(PB13);
SPI.begin();
1 Comment
2024/07/26
10:40 UTC

2

light turning off problem

the lights turn off every 1 minute , I want it to work until I enter the pushbutton to turn it off , any thing to do?

2 Comments
2024/07/26
09:52 UTC

5

How to digitally read analog displayed values like watermeter?

https://preview.redd.it/1emmnblqhted1.png?width=800&format=png&auto=webp&s=2bcbc55b2db377682f9473f0ef4df2cb81da43a2

Greetings together,

I am currently trying to read the value of my water meter. It displays the used water with this rotating number wheels.

The straight forward approach would be to place a camera there with a RPi and OpenCV the hell out of it. But I was wondering if there is any creative yet elegant arduino solution for it? I was thinking about measuring the rotation of this black toothgear like thing with a photodiode or something. Combining that with a once entered initial counter state I could probably approximate the usage. But maybe one of you already had a similar problem or have any better idea to tackle this.

4 Comments
2024/07/26
07:46 UTC

1

problem with i2c on mega

https://reddit.com/link/1ecgeh4/video/zdqb5xd9used1/player

https://preview.redd.it/aeyl854jused1.png?width=4032&format=png&auto=webp&s=4375699975d1c8852424a43418a4cdccb8851f36

im using the i2c pins at the top of the board, i tried pin 20 and 21 still didnt work tried the other arduino and it worked

the code:

#include "Adafruit_VL53L0X.h"

// address we will assign if dual sensor is present
#define LOX1_ADDRESS 0x30
#define LOX2_ADDRESS 0x31

// set the pins to shutdown
#define SHT_LOX1 10
#define SHT_LOX2 9

// objects for the vl53l0x
Adafruit_VL53L0X lox1 = Adafruit_VL53L0X();
Adafruit_VL53L0X lox2 = Adafruit_VL53L0X();

// this holds the measurement
VL53L0X_RangingMeasurementData_t measure1;
VL53L0X_RangingMeasurementData_t measure2;

/*
    Reset all sensors by setting all of their XSHUT pins low for delay(10), then set all XSHUT high to bring out of reset
    Keep sensor #1 awake by keeping XSHUT pin high
    Put all other sensors into shutdown by pulling XSHUT pins low
    Initialize sensor #1 with lox.begin(new_i2c_address) Pick any number but 0x29 and it must be under 0x7F. Going with 0x30 to 0x3F is probably OK.
    Keep sensor #1 awake, and now bring sensor #2 out of reset by setting its XSHUT pin high.
    Initialize sensor #2 with lox.begin(new_i2c_address) Pick any number but 0x29 and whatever you set the first sensor to
 */
void setID() {
  // all reset
  digitalWrite(SHT_LOX1, LOW);
  digitalWrite(SHT_LOX2, LOW);
  delay(10);
  Serial.println(F("1"));

  // all unreset
  digitalWrite(SHT_LOX1, HIGH);
  digitalWrite(SHT_LOX2, HIGH);
  delay(10);
  Serial.println(F("2"));


  // activating LOX1 and resetting LOX2
  digitalWrite(SHT_LOX1, HIGH);
  digitalWrite(SHT_LOX2, LOW);

  Serial.println(F("3"));


  // initing LOX1
  if (!lox1.begin(LOX1_ADDRESS)) {
    Serial.println(F("Failed to boot first VL53L0X"));
    while (1);
  }
  delay(10);
  Serial.println(F("4"));


  // activating LOX2
  digitalWrite(SHT_LOX2, HIGH);
  delay(10);
  Serial.println(F("5"));


  //initing LOX2
  if (!lox2.begin(LOX2_ADDRESS)) {
    Serial.println(F("Failed to boot second VL53L0X"));
    while (1)
      ;
  }
}

void read_dual_sensors() {

  lox1.rangingTest(&measure1, false);  // pass in 'true' to get debug data printout!
  lox2.rangingTest(&measure2, false);  // pass in 'true' to get debug data printout!

  // print sensor one reading
  Serial.print(F("1: "));
  if (measure1.RangeStatus != 4) {  // if not out of range
    Serial.print(measure1.RangeMilliMeter);
  } else {
    Serial.print(F("Out of range"));
  }

  Serial.print(F(" "));

  // print sensor two reading
  Serial.print(F("2: "));
  if (measure2.RangeStatus != 4) {
    Serial.print(measure2.RangeMilliMeter);
  } else {
    Serial.print(F("Out of range"));
  }

  Serial.println();
}

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

  // wait until serial port opens for native USB devices
  while (!Serial) { delay(1); }

  pinMode(SHT_LOX1, OUTPUT);
  pinMode(SHT_LOX2, OUTPUT);

  Serial.println(F("Shutdown pins inited..."));

  digitalWrite(SHT_LOX1, LOW);
  digitalWrite(SHT_LOX2, LOW);

  Serial.println(F("Both in reset mode...(pins are low)"));


  Serial.println(F("Starting..."));
  setID();
  Serial.println(F("out of setup"));
}

void loop() {

  read_dual_sensors();
  delay(100);
}

it never gets past Serial.println(F("3")); or Serial.println(F("Failed to boot first VL53L0X"));

1 Comment
2024/07/26
05:37 UTC

1

Having issues uploading my program for RC project

Hi everyone I am having some issue with a project that I have been working on for a little over two months. I just finished the wiring and 3D printing the components for a custom RC car I am doing as a personal project while I have some free time over the summeri and just attempted to upload the to both the controller and the car. When I take attempt to upload the code to the Arduino Nano while it is disconnected from the other components , but when I connect it there is a response error. I've attached the schematic I designed for my circuits in hopes that someone can help me determine the issue with this. I am getting the following error message from the IDE:

"avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00"

https://preview.redd.it/rwaj26bwured1.png?width=938&format=png&auto=webp&s=1048f0443028af53dda58da3935fb90f2ebbdc3d

https://preview.redd.it/tsquaweyured1.png?width=814&format=png&auto=webp&s=befe72cacca53c8b1f7b2426fb8db9a33cd24272

Thank you in advance!

3 Comments
2024/07/26
02:15 UTC

1

Seeking Advice: 2 Phase 4 Wire wire actuators or 2 Wire actuators?

Hello my fellow Arduinites

 I am seeking some advice.  I am building some toy soldier terrain that is heavily animated via servos, levers et al.

As such, I need to use a linear actuator.  I purchased ones that use 2 phase, 4 wire motors.  Ignorantly I did not pay too much attention to that fact when I ordered them.

I now know that 2 phase, 4 wire motors require more hardware than simple positive and negative leads.  Shame on me…

My question:

  Should I dive in and learn how to use these motors?

  or

  Should I just buy 2 wire motor linear actuators?

This question may be better suited to a “motor sub” but given that I am controlling them with an Arduino, I hoped this place would be more relevant to my question.

Thanks kindly!

2 Comments
2024/07/26
00:43 UTC

3

Level shifting for serial communication

Hi, I've got a quick question. When connecting Arduino with ESP32 using UART or SPI shall I shift the voltage only down to 3,3 V on the Arduino's transmitting part or is it better/required to be done in both directions?

7 Comments
2024/07/25
23:35 UTC

27

Stepper motor runs rough

Does any one know why my stepper motor setup is running so roughly and jittery through certain phases of its acceleration?

code:

11 Comments
2024/07/25
23:10 UTC

1

What's the meta for a moveable arduino project that still has USB accessibility?

I'm not sure if I'm trying to do something unusual, but I want to use an Nano 33 as a basic accelerometer with a 3V button cell battery. But then the help documentation says that once you cut the 3.3V line from the voltage regulator and directly power it from a battery, you can't upload sketches via USB anymore (why?)

So how am I supposed to prototype with the portable aspect as well? Jumper wires to temporarily repair the 3.3V lines when I want to upload a sketch? Really lightweight USB cable to power it while prototyping?

2 Comments
2024/07/25
22:49 UTC

1

Hero board

Sorry don't know where else to post this, but is the arduino uno motor shield compatible with the inventor.io hero board?

4 Comments
2024/07/25
21:44 UTC

0

RHI-110D-CA

Is this sensor accurate? Can it be used in an arduino project? I got it from an old laser printer.

1 Comment
2024/07/25
21:13 UTC

1

(slow) frequency detection on an Uno R4

Is there a library out there I can use to detect the frequency of an input pulse on an Uno R4, when the pulse is really slow? Like 16Hz or maybe even slightly slower, worst case.

https://www.arduino.cc/reference/en/libraries/frequencydetector/ seems to be limited to 38Hz on the low end so it won't work for me. I'm detecting the output of a perforation sensor that goes on and off as film passes it. The film runs between 18 and 25 frames per second, one pulse per frame, and I want a little wiggle room in case it's running extra slow, thus the 16Hz requirement.

2 Comments
2024/07/25
20:22 UTC

1

Using Arduino to connect my ESP32 to my University WIFI

I want to connect my ESP32 dev module to my university WiFi ('eduroam" with WPA2-Enterprise) but for the love of life I can't get it to work.

  • Apparently esp_wpa2.h is deprecated so it wants me to use esp_eap_client.h but I can't find source material on it anywhere.
  • It also returns a error in the .h file itself.

I really want to use Arduino IDE but the only info I find online use ESP-IDE on Vscode but I'm not in the mood to setup all that for a small project.

I have no idea what to do now

7 Comments
2024/07/25
20:12 UTC

1

Does this exist? A PCBA that you can mount an arduino to with higher voltage outputs?

I am about to make one unless it exists already. I want a PCBA (hope I'm using the right terminology) that I can solder an Arduino Nano to that has a buck converter and at least 2 outputs for higher voltage control.

I'm horrible at explain it but essentially a board with a buck converter (24v-9v for arduino power) and at least two mosfet trigger switches that has the PWM pins connected to the arduino so I can control 24v peripherals. The only source voltage input will be a 24v source. That will power the arduino via the buck converter as well as the peripherals via the mosfet trigger switches and the arduino code that I write. I feel like something like this has to exist already.

2 Comments
2024/07/25
19:56 UTC

1

Missing file error

Today my Nano 33 BLE came and I was excited, the sensors I ordered hadn’t arrived yet so I decided to try to find a way to do stuff with the built in RGB on the board, I looked at the docs and found one that uses its Bluetooth to allow your phone to control it’s RGB LED this is the link to the tutorial: https://docs.arduino.cc/tutorials/nano-33-ble-sense/bluetooth/ Anyway, when I was debugging the code it gave me the error that’s in this pastebin link https://pastebin.com/HNR2NGd3 This is my first time using an Arduino so I’m not sure what I did wrong Also i copy and pasted the code into this pastebin link https://pastebin.com/i2hZMffh

2 Comments
2024/07/25
19:43 UTC

0

Arduino in Visual Studio for a newbie

I'm approaching the end of the Paul McWhorter videos on Arduino. I've started looking at c++ as well and found it massively helpful. My employer also has a bespoke piece of software we use which is coded in c++ and whilst I don't work on the code, it would be beneficial career wise to understand it better.

My wife codes and has been going on about visual studio. I can see there are a few options for how to program microcontrollers with it but I'm wondering if it is sensible or easy to move from the Arduino ide to visual studio (with platformio for example) as some who is newish at coding. I can see it giving me more of a full fat experience of c++ and a proper development environment.

I'm planning on sticking to the Arduino c++ for the time being but working with different boards (esp32, nano, R4, Pico). Not currently planning trying micropython. So t know why but from the little I've done it didn't sit well.

6 Comments
2024/07/25
18:29 UTC

1

Need help with LCD and DHT11

Need help with lcd and dht11

Need help w lcd and dht11 I'm kinda a beginner and I'm trying to display dht11 on lcd. Data shows in serial monitor on pc, but won't show on lcd. Idk what I'm doing wrong. At first i was trying it solo, but couldnt figure it out(had the same issue) after i tried to following some videos but still the same outcome. LCD is brand new, i doubt theres problem in there.

https://preview.redd.it/z37glnmqcped1.png?width=720&format=png&auto=webp&s=bd8e1981272923b526354f034ac1adf1a6058f86

#include <LiquidCrystal_I2C.h>
#include <DHT.h>
#include <DHT_U.h>





LiquidCrystal_I2C lcd(0.27 ,20 ,4);

#define DHTPIN 7
#define DHTTYP DHT11
DHT dht(DHTPIN, DHTTYP); 



void setup() 
{

  lcd.init();
  lcd.backlight();

  dht.begin();

  Serial.begin(9600);
  delay(500);
  Serial.println("DHT11 senzor vlhkosti a teploty\n\n");
  
}

void loop() {
  
float v = dht.readHumidity(); 
float t = dht.readTemperature();




Serial.print("terajsie vlhkost = ");
Serial.print(v);
Serial.println("% ");


lcd.setCursor(0, 0);
lcd.print("vlhkost= ");
lcd.print(v);
lcd.print("%");

Serial.print("terajsie teplota = ");
Serial.print(t);
Serial.println("C ");


lcd.setCursor(0, 1);
lcd.print("teplo= ");
lcd.print(t);
lcd.print("C");

delay(5000);


}

1 Comment
2024/07/25
17:47 UTC

0

Arduino clone

Hi, I'm new with Arduino projects and I'm searching information about compatibility between Arduino Cloud and unofficial Arduino board like this:

https://a.aliexpress.com/_EHfc7wL

1 Comment
2024/07/25
15:40 UTC

1

Best way to get variable voltage (10V +/- 2V) out of Uno R4

I need to supply approximately 10VDC to a device from an arduino, but I need to be able to modify the output voltage quickly, on the fly, in my code. The range should be somewhere between 8-12V. (I should note that I can be a little flexible on the output voltage and could probably make a 6-10V range work). What's the best way to do this?

Should I output PWM to a converter like this: https://www.amazon.com/EC-Buying-Converter-Adjustable-Conversion/dp/B0CPJGFCGR/

Or is there a better way? If there's a way to do this on the arduino I'd do that. I'm not powering anything so the current is practically nothing. All I'm doing is sending a control signal to another device to change its speed, but I do need to finesse it to get the output pretty precise.

Space is not really a concern. All of this will live in a 1U Rackmount box so there is more than enough room. I'd prefer something off the shelf so I can just get this going, vs designing a circuit from scratch.

(Edit - pasted the wrong amazon link the first time)

5 Comments
2024/07/25
18:03 UTC

Back To Top