New answers tagged

2

Random Characters can Happen in several ways. Check the Wires for: Loosen Ends; Broken Wires and Wrong Pin Connections. Check your Code.


0

This is not exactly what you are asking for but it would be robust and available at low cost in the form of arduino modules. The way I would do it is use a Can Driver and receiver on each end. They are inexpensive differential line drivers. There is nothing that prevents using Async at whatever baud you want up to about 1 megabaud. Run a wire for ground it ...


1

the RX1 or Arduino mega to the TX1 of the sensor (pin2) and That will not work. These pins are for RS232, which uses the same communication protocol (UART) as the Arduino, but it uses different voltage levels. But fortunately your sensor has also RX and TX pins at TTL level (Transistor-Transistor-Logic). You want to connect these to the Arduino. One thing ...


0

No, not as far as I know. The firmata protocol does not include a command to set the analog reference. However, you can of course modify the firmata firmware to your liking. In the simplest case, just add the appropriate command to the setup() function of the main .ino.


0

Consider taking on this project in sever steps. Some you might do now and other later if necessary First, accelerometers do not usually need alignment. But if accuracy and reproducibility is important, a project may benefit from finding any offset a single accelerometer may need and finding any magnitude adjustments between the three accelerometers. Using ...


1

I've got I2C to work reliability between Arduinos with different byte sizes. I have copied the test code below. Note that there is separate code for sending and receiving. It may need to be tweaked but contains the basic idea. One (or more) Arduinos sends to main I2C controller: Sender Code: //sender test #include <Wire.h> #include <Wire.h> #...


0

It is difficult to determine from the diagram if the green wire is at the same voltage as the black wire supplying power to the Arduino board. Even if they are connected, it is difficult to say if the current is nominal. As there is a power supply of unknown design involved for both the Arduino and the float switch. This could cause unexpected results and ...


2

Your calculation is not correct. The encoder has its 0 to 10V output voltage distributed over the whole distance, that the cable can reach, so 1.25m. And that gives you the resolution: 1.25m/1024 = 1.22mm. The resolution doesn't change, if you use less than the maximum length. It's still the same resolution of about 1.22mm. The encoder doesn't care, if you ...


0

The best solution would be to use an RS485 adapter connected to each Arduino via serial port. This is a tried and true solution that is perfect for a setup like this and only costs a few bucks of extra hardware per node. If you can't use additional hardware, you can also create a poor-man's current loop system like RS485 using normal Arduino pins since they ...


1

There's not enough information to provide a general solution at this time. As chrisl rightly says, the 3D printers are expecting a connection from a host. That host connection depends on whether the USB-serial interface inside the printer is supported. These are typically FTDI or WCH (QinHeng) chips, and would need the appropriate system driver for each type....


6

Its not as easy as you think. An Arduino will not be enough for connecting the USB of the 3D printer. The USB protocol is strictly divided into slaves and masters. A USB(us) has exactly one master, which totally controls, what the slave can do. The slave itself cannot do much of its own. Your 3D printer is a USB slave device. That enables a USB master (like ...


2

The Nano, like the Uno, has an onboard serial ↔ USB converter. If you can get a logic level serial from the Moxa, then you can use the Nano to convert that to USB: Load a do-nothing sketch in the Nano Connect the Moxa TX to the Nano's Tx through a 1 kΩ resistor, and the Moxa RX to the Nano's RX. Yes, the second step looks backwards. The reason is that the ...


0

You need to use Serial.readStringUntil('\n') instead of Serial.readString if you use the Arduino IDE's serial monitor (where a \n is added as termination character when you press enter). Also remove that while(Serial.available()==0). It will wait as long as there are any bytes in the serial buffer and as you don't Serial.read() within the loop, the buffer ...


4

First of all you have to make sure, that you select the same baudrate in the Serial Monitor, that you used in your sketch with Serial.begin(). This error is very common and garbage values is the symptom of this. But your code also has problems. You have the input variable of type String, which should hold the user input for comparison with the password. ...


1

PS: @lurker's suggestion in the comments - check the baud rate setting in your serial monitor as well. EDIT: I admit that the code in the previous version of this answer was foolishly typed out by me due to lack of patience, so I'll make up for my mistake(not in code, but as a full answer). First of all, I didn't understand what you wanted to do with the ...


2

Just adding some numbers to complement JRobert's answer. On the Uno, the cost of calling a function and returning from it is about 0.5 µs. In contrast, calling analogRead() within a loop costs at least 112 µs per iteration. Given that you are computing the sum as a float (where a suitably sized integer would suffice), it may well be more that 112 µs in your ...


2

Writing the code out four times, in line, is a little bit faster than calling a function because the function call and return take some time, and the loop instructions take some time, and neither of those contribute to the average calculation. Writing a function that you use four times, however, is much more readable, is much easier to fix if you've made a ...


1

This buildin LED is connected to an IO pin of the microcontroller on the Mega (most commonly pin 13, but might be different depending on the board). So the meaning depends on what the code on the Mega does with it. When the board is reset (which happens on opening of serial connection), first the bootloader will run. It gives you a short blink on the buildin ...


Top 50 recent answers are included