![]() To check the accuracy of the sensor Im going to use my ruler. If the distance is being displayed., What Why is it displaying 0 Ooooooh.? I forgot to change the pin. There, it is on COM15 Click on Build, Then upload. Lets plug in the Arduino to the computer. We declare the input, pins, read them and display the values. The code works pretty much just like with other sensors. First lets remove these 2 since were only going to use 1 sensor. The sample code right here for some tests. First Lets search for SR04 and add it to our project. After creating our project file, lets go ahead and add the Ultrasonic Sensors library. ![]() I just prefer VS Code with Platform, IO IDE Extension nowadays. Do take note, though, that we can also use the Arduino IDE for this. , Now that we have connected everything lets test the Ultrasonic Sensor using its librarys sample. And, lastly, lets connect the WS2812B Addressable RGB LED Strips Input, Pin to Arduinos Digital Pin Number 6, Then 5V to the 5V rail and GND to the GND rail of the Breadboard, Like so. ![]() Lets connect Arduinos, 5V and GND to the 5V and GND rail of the breadboard as well. Lets put this one right here and then connect the first pin from the left to the 5 volts rail, The third pin to the ground, rail And the second pin to Arduinos Analog, Pin Number 0. Number 4 Green is Trigger, which is connected to Digital Pin, Number 3 and Purple is Ground which is connected to the ground. In my case, Yellow is VCC or 5 volts, so I have to connect it to the 5 volts rail of the breadboard Blue is Echo, which is supposed to be connected to Digital Pin. Connect our jumper cables to the Ultrasonic Sensor. Im thinking that maybe we should just connect everything first before we do some tests. And, lastly, a data cable., As you can see here, on the Schematic diagram wiring: it is pretty easy because we only have to deal with 6 pins. A 10K Potentiometer to control the brightness level of the RGB LED Strip., A breadboard of course., A few hook up wires and jumper cables. You can also use other light sources like what Ive mentioned: earlier. A WS2812B Addressable RGB LED Strip to light up the dark. The star of the show … An HC SR04 Ultrasonic Sensor. Im going to use my newly acquired Arduino NANO Every to manage Well Everything., You can use other MCUs if you want of course. Dooooown BELOOOOOW Here are the things that we need. All the necessary links, including the sources, codes, schematics and other good stuff, would be available on the description. Also just like on all of my previous Arduino Projects. And Ive tried to use one for this same purpose, But due to space constraints, I cant use it to trigger a night light for my room, Because every time I or my dog move When I try to sleep, The light would turn on and the minimum or shortest sensing distance you can set it to is just 3 meters, which is a little bit too much. In order for us to make a Distance Activated Night Light with Brightness Control., It would basically perform the same functions as an HC SR501 PIR Motion Sensor by acting as a switch or trigger to turn on a light, But in a more precise ish way, Ive used Pir Motion Sensors before Click right here to check it out by the way. Mark Kriegsman ( kriegsman) joined the project in 2013.Today were going to utilize, the HC SR04 Ultrasonic Sensors capability to measure the distance of targeted objects by interfacing it with an Arduino, A WS2812B Addressable RGB LED Strip And a 10K Potentiometer to control its brightness level.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |