We’re rewarding the question askers & reputations are being recalculated! Read more.

Hot answers tagged

5

You need to solder those headers to the breakout. Just inserting them into the plated-through-holes doesn't give a reliable connection.


4

Yes, that's the idea behind bus protocols like i2c. You only require the sensors on i2c to have different bus adresses. A sensor's address usually can be chosen by soldering a jumper (the mpu6050 provides this feature on pin AD0). If you can't avoid an address collision you could use an i2c multiplexer or a microcontroller in between the sensor and the ...


4

First things first; please INDENT YOUR CODE. The code you posted is a mess and I took at least double the time to fix that. First, you have an extra closing curly bracket at line 17 and the if (Fire == High); should be changed to if (Fire == High){ Fixed code: int Led = 4; int Buzz = 7; int Sensor = 11; int Fire = HIGH; void setup() { Serial.begin(9600)...


4

A signal is just a varying voltage. A wire is just a (very long) small resistor. The device reading the signal is just a current sink. That's three terms there: voltage, resistance, and current. Three terms you should know are related by Ohm's Law. Also, some simple rules: The thinner the wire the bigger the resistance The longer the wire the bigger the ...


3

LTC4316 is what you need. I haven't used it yet, but I know it from a project that did: mocap. It is an I2C translator IC. Of course, if you need those ICs to be far away from each other, use a uC (or a separate Arduino) with all of those, and connect them with a different protocol!


3

I will leave a simplified answer and I would recommend to read https://www.makeuseof.com/tag/getting-started-with-arduino-a-beginners-guide/ or similar to get a understanding of how to code. An Arduino sketch has a structure. Initialising values A void setup() this code only run once the MCU is started A void loop() and this code runs continuously. So to ...


3

The DHT11 is a digital device. You cannot read from it with analogRead(). While temperature is an analog value, that's not how the DHT11 communicates with an Arduino. There is a specific digital protocol. In your code, it appears you have added the headers for the Adafruit Sensor library and DHT library, but you never actually call the functions provided ...


3

The specification1 says (emphasis is mine): using IO trigger distance, the high signal to at least 10us. So, longer than 10 μS is not a problem. With respect to less than 10 μS, well 5 μS may also work, but it is out-of-spec and therefore not guaranteed to work and so may not always work correctly, or as expected. From Source 1:...


3

I don't see a second power-supply in your photo. If you're trying to run the pump directly from an Arduino pin, it is highly likely that the pump needs way more current than the pin can supply. It may be possible to power the motor from the USB but 1) the Uno board doesn't make that readily available, 2) it puts your PC at some risk (of back-EMF or of over-...


3

The UGN3503 that you use gives out a analog voltage that changes when there's a magnetic field present. So this sensor needs to be connected to an analog pin. If there is no field present the voltage is around 2.5Volt. If the south pole of a magnetic field is present the voltage will be higher that 2.5V. With a north pole the voltage will be lower that this ...


3

You seem to be experiencing cross-talk between the analog channels. This happens because all the channels are funneled by an analog multiplexer into the same sample-and-hold capacitor. If the source resistance is too high, then the capacitor does not have enough time to charge to the voltage of every channel. Here is what the datasheet of the ATmega328P ...


3

You are wasting a lot of power in your system. You need to be far more efficient when running off battery. Don't boost your battery voltage to 5V. Instead use a system that runs entirely at 3.3V. Never use a linear voltage regulator like the AMS1117 since it just wastes power as heat. Instead use a switching "buck" regulator. Turning off modules when not ...


2

I would suggest finding sensors that work on an I2C bus. This way all the sensors are only using two pins for data. That will free up other outputs for motors, heaters that will probably be on relays or other drivers that need a single or multiple pins for each devices. As you start to plan it out, if you do run out of pins on a arduino uno, look at the ...


2

Following is an example how it could be coded. Remember that the soil is dry by setting DrySoil = true. Register the time at which a dry period starts in DrySoilBegin. Check at each 'dry' reading whether DrySoil was true for more than 20 minutes. Set DrySoil = false at every 'not dry' reading. The ul after the constant 1200000 makes it an unsigned long ...


2

I think that the problem is here: output_value = map(output_value,1024,0,0,100); output_value1 = map(output_value,1024,0,0,100); output_value2 = map(output_value,1024,0,0,100); output_value3 = map(output_value,1024,0,0,100); output_value4 = map(output_value,1024,0,0,100); replace them with: output_value = map(output_value,1024,0,0,100); output_value1 = ...


2

You might get away with powering a PIR sensor from a logic line. Check the specs. If it draws less ≤20mA you'd be fine. If you nee to drive more current than that you can use a CMOS TTL Driver or a properly selected N-channel MOSFET. Adafruit sells these, for example. A relay is another matter. If you this is one of those optically isolated relays and all ...


2

In the Arduino IDE, click on SKETCH > INCLUDE LIBRARY > MANAGE LIBRARIES. Then, search for 9250, select the SparkFun one, and click INSTALL. Finally, from the examples, choose the MPU9250BasicAHRS_I2C.


2

There is no way of "automatically" combine two sketches into one. That's because resources of Arduino are very limited. For example UNO it has only 4 timers. If both of the sketches want to use same resource they will not work properly. If you want to combine two sketches into one you have to write a new sketch that combines mechanisms of both sketches. It'...


2

You can't send arbitrary information (percent signs, text etc) to the plotter. The plotter only understands numeric values. You have to separate these number values from each other with commas, then do a println in your last value: Serial.print(percent); Serial.print(F(",")); Serial.print(tankPercent(depth)); Serial.print(F(",")); Serial.print(litres); ...


2

I found the I2C address on my Eagletree Airspeed V3 sensor to be 0x75 NOT 0xEA. the following code adapted from first sample above works on my Nano: /* * note that timming is critical - see delay (5) * and bps set to 115200 * works ok, but clean up 5-19-2019 jaf */ #include <Wire.h> #define AIRSPEED_ADDRESS 0x75 #define WRITE_BIT 0x00 #...


2

In general: All #defines and #includes get put from all separate sketches, at the top. Globals and function definitions (except for setup() and loop()) get mixed together below the #defines and #includes. All code in the separate setup()s get put in the combined setup(). All code in the separate loop()s get put in the combined loop(). You have to be ...


2

If I understand your question correctly, your problem is probably that the working range of the AJ-SR04M sensor is 20cm - 500cm. The sensor uses the same transducer to create the sound pulse and to listen for the echo. It needs time to switch from one mode to the other, which explains why your sensor can't measure distances of less than 20cm. The speed-...


2

Your drawing seems to show plenty of pins available, with only pin 2 in common. If the pin is being used for an Interrupt, then one device can use a different pin instead and the code adapted to use PCINT for the interrupt. I would suggest the PIR does not even need an interrupt, it is slow changing and polling it for activity would be just as effective. ...


2

first of all, you need to understand how these sensors work. the sensor itself is just a resistor (like a normal resistor, with 2 legs) which is constructed from materials that are affected in presence of a specific gas. the gas changes its resistance. but as it's obvious, these type of materials are not calibrated. in order to make that resistor sensitive ...


2

I think your problem might be connected to wiring. This is one of the ways you can correctly connect a switch to Pin 8. In this case you need to configure Pin 8 as INPUT_PULLUP to use internal "pullup" resistor. When switch is not pressed Pin8 is connected to 5V through that resistor and value on the pin is HIGH. When you press the switch it connects Pin 8 ...


2

I've done some more search on the interwebs and found someone (in Spanish) describing the same problem. That person owns an oscilloscope and could confirm that there is some bouncing on the data signal both going up and down. The hardware solution presented is to place a 100 nF capacitor between the signal pin and ground. I've tried it and it works.


2

I2C is a bus. There can be many devices connected to that bus, each one having it's own address. Everytime you want to communicate with one of them, you have to send the address of the device. When you are using the Wire library, thats done by calling Wire.beginTransmission() or Wire.requestFrom(). Most slave devices have an adress, that is partly ...


2

Easy, this is one of the simple projects used as an introduction to Arduino programming. You will find many versions of free code out there. below is an example and a total newbie step-by-step. Download Arduino IDE. Buy an MQ7, an Arduino or NodeMCU, a breadboard, a LED and some jumper wires and you are in business. Use the sketch below or google "MQ7 ...


2

I have a couple of suggestions: The combined code is very different from the simple LM35 code that works. I'd suggest you start with the combined code but comment out everything that doesn't directly apply to reading the LM35, and get that working correctly. The interrupt service routine (ISR) is trying to do too much, and leaves the interrupts off during ...


2

A good way to start debugging this sort of problem is to print out debug statements that say what the hardware should be doing. If the debug statements print out as expected then it's probably hardware, if not, then it's probably your code, e.g. if (percent < threshold){ Serial.prinln("LED on."); digitalWrite(LED_BUILTIN,HIGH); } else { Serial....


Only top voted, non community-wiki answers of a minimum length are eligible