Hot answers tagged

8

No, it will not be any faster. The extra instructions are to access the extra flash memory of the 2560. Instructions like EIJMP - Extended indirect jump, EICALL - Extended indirect call, etc. The compiler option -O3 optimises the most, but there are other options you can enable, such as -funroll-loops which will cause major code bloat but speed things up. ...


6

Use the newest Arduino IDE, because some time ago the 'lto' option was added which is a major optimization for both speed and size. It is possible to test a few compiler options with the #pragma. Try for example these at the top of the sketch: #pragma GCC optimize("-O3") #pragma GCC optimize("-ffast-math") The 'fast-math' is dangerous, be careful with it. ...


6

I advice you to learn about basics of how to connect external components to MCU. Anwser to your question is simple transistor amplifier... So you can use bipolar transistor (NPN/PNP) or MOSFET... MOSFETs is better for switching like your case, switching via PWM. If you switching inductive load with MOSFET like motors or coils, don't forget add antiparallel ...


3

the ADC is LTC1859 and triggers on the slave select falling edge. No, it doesn't. Here is a link to its datasheet. It has a pin labeled CONVST, for “conversion start”. According to the section Pin functions, “This active high signal starts a conversion on its rising edge.” If you want your sampling to be at 2 kHz with cycle-accurate timings, you have to ...


3

In the platform.txt file found in ~/Arduino15/packages/arduino/hardware/avr/1.6.17 or similar, you can change the three instances of -Os with -Ofast. The size of the code can increase dramatically though.


3

However, despite ESP8266 running at 160MHz, 10 times faster than nano, it's taking 3.5 ms to complete the loop, compare to 2.5 ms than that of nano. There's a number of reasons for that. Chiefly: The ESP8266 has no I2C hardware, so has to use software "bit-banging" to emulate I2C. That is slower to execute. The ESP8266 also has to manage the WiFi hardware ...


3

At 115200 baud you can send 11520 characters per second. At 20 bytes per packet you can send 576 packets per second. That's 1,736µs per packet. That's assuming zero wait between bytes. That's not going to happen. Your measurement of 70µs will just be the time taken to place data into the transmit buffer, and has nothing to do with how long the transmission ...


2

So my question: is 20 ms enough to read like 50 pages of 512 bytes from an SD card which are located on different (but known) file offsets within a 2+ MB file? Let us do the numbers: 50 * 512 = 25 Kbyte in 20 ms is 1.25 Mbyte/s. As the max speed for SPI is 1 Mbyte/s (on Arduino AVR, 16 MHz) we do not have to go any further. The answer is: No. Cheers!


2

48 MHz is a multiple of 16MHz. Why not just adjust the timing code to account?


2

Wifi modules decide on link speed based on signal strength. So you can estimate the link speed with signal strength, which you can get with WiFi.RSSI(network). The datasheet of ESP8266 contains a table mapping RSSI to link speed under "Sensitivity": -98 dBm: 1 Mbps -93 dBm: 6 Mbps -91 dBm: 11 Mbps -75 dBm: 54Mbps -71 dBm: 65Mbps, 72.2Mbps Whenever ...


2

The error in this method would be massive. Velocity is the integration of acceleration over time. However, you don't have acceleration over time - you only have acceleration at discrete points in time - the times that you actually sample the acceleration. You would want the total acceleration between two points in time, which you just don't have. Take the ...


2

OK. Looks much better now. And I see one problem. It seems that the normal way to do the speed control is with a pot. A variable voltage at the input depending on the rotation. The Arduino low end designs have an analog out capability but it really is not analog. It is a pulse width variable signal that produces an on percentage between 0 volts and the CPU ...


2

In theory, it should work to control the speed of fan. The manufactures description mentions "fan regulator". One of the pictures shows on the backside of the module that it is for 2 A (5 A peek). This should be good for 230 V / 100 W motor. The module gives you a basic circuit to control AC. It reports zero-crossing and has an optocoupler switch to turn AC ...


2

It won't work, as you don't give it any time to do anything. The PWM works about 1kHz and motor needs much more time to start rotating. And you are sending values as fast as possible (it means microseconds for every analogWrite) And analogWrite(300) without changing the Arduino default settings means it overflows to value 300 % 256 = 44. All Timers are set ...


2

It's not just the SPI what limits overall speed. You also need some proccessing power, and AVR based Arduinos lacks of it. It all depens what do you want to do with data. If you need some serious processing power, it might be better to use something much more powerfull, like raspberry PI with real operating system. You can even run some web server at the ...


2

Speed calculation in most GPS systems is very crude. It consists of simply "Where was I then? Where am I now?". Many will also add "How long has passed between then and now?", but many also don't - they assume a fixed time between points (1 second, for example). It doesn't know it's supposed to move, all it knows is the coordinates it has at the moment. ...


2

If you are looking for throughput then stop sending the ASCII conversion of numbers and just send the numbers. In other words, use Serial.write() rather than Serial.print(): you can send ~25k integers per second with a 52k baudrate. As you are actually remapping the ADC output to a single byte, that means you can easily achieve a 48k/s throughput with this ...


2

Answer is simple. You assign 38400 to a variable of type int. The signed range of integer values that can be stored in 16 bits is −32,768 through 32,767;


2

It sounds like occasional "misses". Possible causes include: the magnet passing far enough from the reed switch to "only just" trigger it [narrow the gap.]; the magnet's passage being too short for the reed switch/capacitor to respond [use a wider magnet or move closer to the center of rotation]; Too much capacitance [reduce it or debounce in software]; ...


2

I have built many years ago a device nearly identical to what you describe. I did not have the additional requirement of a minimum speed of 10 kph, however. As noted in the comments, that is likely best resolved with GPS as you are detecting motion, not absolute speed figures. I used "arduino gps library" as the search terms and found many options. One of ...


2

I have tested it on real motor, and it works as I want with function .moveTo . Speed slowly changed from +maxSpeed to -maxSpeed acording to Acceleration #define maxSpeed 1000 #define Acceleration 500 ............ void setup(){ stepper.setMaxSpeed(maxSpeed); stepper.setAcceleration(Acceleration); } void loop() { ............ if(bDirection!=...


2

As far as I can tell the Arduino does not have open collector outputs, so you can mimic one as follows. The following inverts the Arduino output signal, so some adjustment is needed there when generating the PWM signal. Excuse the rather gross schematic. I can't find any scaling parameters. The particular resistors values are not terribly important, mainly ...


2

ISP programmers typically default to low ISP clock rates. Often something like 10khz, sometimes slower, probably to just work by default with very slowly clocked AVR chips. The ISP clock rate must be about one eigth that of the AVR's clock. For example, by defaulting to a low rate like 10Khz, the programmer will successfully communicate with an AVR ...


1

I did a project generating VGA signals that required highly precise timing for the sync pulses. The technique that worked for me was: Use the hardware timers to generate the required pulse interval Put the processor to sleep (set_sleep_mode (SLEEP_MODE_IDLE);) to remove jitter caused by whether the interrupt occurred while an instruction was executing (...


1

Referring to this datasheet you have connected the transistor the wrong way around. Also, 1M resistor at the base is way too high. Bipolar transistors are current amplifiers (amplification at about 50-100 in your case) and with 1MOhm at the base there will be no current through the base at all. I would try with 2k for a beginning. I hope you have another ...


1

Two things to test: Have you tried to put an LED (and resistor to protect it) in the motor's place? If the brightness changes, your setup (Arduino+transistor) is working. If not, maybe you've killed your 2N2222 by giving it a wrong diode or something else is wrong. Have you tried reducing the PWM frequency? An LED can follow a fast change, but a motor can't....


1

Well, 2M resistor to the base? If the motor is running with that, the transistor must be broken (shorted). Just try to check if the motor is running with disconnected base. You can also check PWM output by connecting LED with resistor (no, not 2M ohms, just about 330 ohms). For the transistor 1k should be sufficient maybe little less (depends on motor ...


1

Maybe for the second function you want something like this: void stepper_run_cw(void){ stepper_step_cw(1,0,0,0,1); stepper_step_cw(1,1,0,0,1); stepper_step_cw(0,1,0,0,1); stepper_step_cw(0,1,1,0,1); stepper_step_cw(0,0,1,0,1); stepper_step_cw(0,0,1,1,1); stepper_step_cw(0,0,0,1,1); stepper_step_cw(1,0,0,1,1); } void stepper_step_cw(...


1

Remember if you are using a UNO or similar there is no Analog Output, the output is PWM (Look that up). If its DC motor then it needs to work from a DC (constant voltage) and will spin at a fixed speed. Motors usually have a RPM (speed) specification. Speed can be reduced with gears and rotation detected with rotary encoders and or sensors like Infra Red ...


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