Notifications
Clear all
Search result for: WA 0852 2611 9277 [[GLORION]] Biaya Pasang Backdrop TV Dapur Apartemen West Point Jakarta Barat
Page 1 / 3
Next
Yes Arduino can do floating-point operations, but there’s a few things to keep in mind.
1. On boards like the Uno or Nano (which use the ATmega328P), it supports float and double, but the funny thing is—they’re actually the same thing. Both are 32-bit IEEE 754 floating Point numbers. So don’t expect extra precision with double, it's just a float behind the scenes.
2. It can handle basic operations like addition, subtraction, multiplication, and division just fine. But it’s not super fast at it, since the 8-bit microcontrollers don’t have a floating Point unit (FPU). That means it does all floating-point math in software, which can slow things down if you’re doing a lot of calculations in your loop.
3. Also, things like sin(), cos(), sqrt() and pow() work, but again, they’re kinda heavy on processing time. So if you’re working with sensors and need to process stuff quickly, it’s sometimes better to stick with integers where possible, or scale up the values and work in "fixed Point" math if you can.
4. One more thing—printing floats with Serial.print() only shows two decimal places by default. You can control that though:
float pi = 3.14159;
Serial.print(pi); // prints 3.14
Serial.println(pi, 4); // prints 3.1416
So yeah, Arduino can handle floats, but it’s not optimized for heavy-duty number crunching. If you're doing more advanced math or need higher precision, better to move to something like a Teensy or a 32-bit board like the Arduino Due or even ESP32. But for basic stuff, it’s totally usable.
I’m working on a project that requires floating-point calculations and would like to understand how Arduino handles them. How efficient are these operations, and what level of precision can I expect? Are there common issues like rounding errors or scenarios where floating-point math should be avoided, especially on boards like the Arduino Uno? Any insights would be greatly appreciated!
To identify the neutral wire safely, start by disconnecting the mains power at the main breaker—this is absolutely essential for your safety.
Next, use a multimeter to verify that the phase (live), neutral, and protective earth (PE) wires are separate by measuring the resistance between each pair:
phase and neutral, phase and PE, and neutral and PE.
Each measurement should show high resistance, typically in the megaohm (MΩ) range, indicating proper separation. If you get low resistance readings, there may be a crossover or shared connection in the wiring, which is often difficult to trace—especially in older homes.
Once you're sure the circuits are isolated, you can run a temporary cable from a known neutral Point to the location you're testing. Measuring the loop resistance at that Point will help you determine which wire is which.
Finally, before handling any wires, always check for voltage using a multimeter—even if you believe the power is off. In older installations, improper wiring or feedback from other circuits can leave wires unexpectedly live, so never rely solely on switches.
Safety first.
That's a great observation and a very common question. The reason birds don’t get electrocuted while sitting on high-voltage power lines has to do with how electricity flows.
Electricity needs a path to flow—from a higher voltage Point to a lower voltage Point (or ground). When a bird perches on a single wire, both of its feet are at the same electrical potential. Since there's no difference in voltage between the two contact Points, there's no current flowing through the bird’s body, which is what causes electrocution.
However, if the bird were to touch two wires at different voltages at the same time, or a wire and a grounded object (like a pole or transformer), then electricity would flow through it, and it could be fatal.
So, it's not about the bird’s size—it’s about the fact that it’s only touching one wire and not providing a path for current to flow through.
To the Point answer by Techtalks. Just WAnt to add one important Point here:
The PWM pins on UNO have an 8-bit resolution. This gives us 256 discrete duty cycles, since 2^8 = 256. Example:
2 bit means 4 possible duty cycles. For PWM, they would be: 0, 33.33%, 66.66%, and 100%. Similarly, 4-bit means 16 duty cycles, and 8-bit means 256 cycles.
Now why does the PWM range from 0 to 255 and not 256?
Because when you count 0, the total values from 0 to 255 are 256.
Good Point! True, even small habits like grounding yourself or avoiding carpets go a long WAy if a full ESD setup isn’t available."
@ankunegi Thank you that WAs kind of you, I had connected up the capacitor and tinker cad said "wrong WAy round " so I left them ,,, not knowing what I WAs doing ... Another "similar" circuit I have suggests 440 ohm resistors I will use your suggestion. Once I know the circuit works ..I have a safe Point to retreat back to Once again thank you for taking the time to look at the tinkercad sim kind regards Stephen
Electrical isolation and grounding serve different purposes:
Electrical isolation means separating two circuits so that no current flows between them. It's used for safety and to prevent interference—common methods include transformers and optocouplers.
Grounding connects system parts to a common reference Point (usually earth) to stabilize voltages and safely divert fault currents.
If you connect the LDR directly to 5V and the analog pin, there would be no voltage drop across the LDR irrespective of its resistance value. The analog pin would always read a constant 5V because there is no reference Point to indicate a change in resistance.
To detect the change in resistance of the LDR, the voltage at the analog pin should change accordingly. This is done using a voltage divider circuit.
In the voltage divider circuit, as the resistance of the LDR changes with change in light intensity, the voltage drop across it changes as well. The analog pin, connected to the Point between the LDR and the fixed resistor, reads this changing voltage. This allows the Arduino to continuously register and interpret the varying light levels.
Good Point by @FullBridgeRectifier . Just to clarify for anyone new to this: when we say “divide by 255 instead of 256,” it’s because we’re looking at the maximum value the PWM can take, not the total count of values.
This WAy, your duty cycle calculations always correctly reach 100%.
You are forgetting the whole Point of the pull resistors: they ensure that the pin remains in a stable state(either 5V or Ground) until an opposite voltage state is given to it so that the pin can detect this state change and the system can perform some action. If you will connect it to 5V directly, it will never be able to detect the GND because then it will be connected to two different voltage state at the same time causing a short circuit. The high-value pull-up or pull-down resistor ensures this does not happen.
@ankunegi The answer is on Point but I think there's a mistake in your calculation. To calculate the duty cycle, we have to divide it by 255(the maximum value) and not 256(The total no. of steps).
For example: A 2-bit PWM signal has 4 possible steps: 0,1,2 and 3 corresponding to 0%, 33.33%, 66.67% and 100% duty cycle. You get this by dividing by 3, not 4. If you divide it by 4, you will get 25%. Which means 0%, 25%, 50% and 75%. See, you are not getting 100% duty cycle in this case.
Page 1 / 3
Next