Connecting two Arduinos via serial and using one to control the other - arduino

I'm a beginner with this stuff and I'm having a bit of a problem. I've tried searching for an answer and I'm possibly wording my search wrong, but I can't find anything to help me out.
I'm looking to connect two Arduino Unos via the TX RX ports, and connect a bend sensor to one and an LED to the other. I'm looking to make the LED fade up and down in relation to the bend sensor value. I've got my code working so I can do it all on the one Arduino, but most of the things I've found while searching have been related to passing single characters via the RX TX ports and using the Arduino to connect to other things that aren't other Arduinos.
Any help would be massively appreciated. Thanks.

you can use spi, or 2 wire!
here are some links:
spi - http://arduino.cc/en/Reference/SPI
wire - http://arduino.cc/en/Reference/Wire
wire might be more fitting for your situation?

Related

Getting two arduinos to interact without wiring them together

Okay, I've been working on this project for months with this being what has stopped me, heres the situation.
I am making a glove that can move a robot arm. The glove has an Arduino Nano iot 33 attached. The board measures the orientation with the built in imu, and sends it to my laptop (will be a raspberry pi in the future) through a usb cable. Also connected to the laptop is an Arduino Uno r3. This board is what makes the robot move (the servos are wired to it and I attached a display that shows the orientation of the glove here). I pondered how to make the Arduino Nano communicate to the Arduino Uno for a while, and I settled on keyboard presses. The Arduino Nano would press certain buttons based on its orientation and the Uno would wait for them to be pressed to move the robot. Turns out that after over 1000 lines of code, the Arduino uno can't use the keyboard library, and I'm stuck again. Is there a better way to go about this?? or is there a way to get the Arduino uno to get keyboard commands (I'm sixteen, tryin to save for college, I know theres a way to buy something to bypass the boards chip, I've already spent quite a bit on arduinos and PLA and such, and if im gonna buy something I want to use it again, please keep that in mind)
How would you have gone about this? How can I recover this project? Please help me...
this is an amazing project.
Great idea the link over SerialUSB, but it is very very slow...
You should use a radio transmitter like this.
Else, there is a great tutorial for communication using Bluetooth master & slave (warning: the post is in Italian).
If you still want to use SerialUSB, you should use a program that reads input from Nano and send a hex. code into Arduino Uno.
Library for serial communication with java or ruby.
Library for serial communication with Arduino.
I hope this can help you. Good luck!

Arduino Accelerometer mpu6050, No raw data

I am working on a project which uses an accelerometer with an arduino Nano.
I am using the MPU6050. However I have the same static values wether I move the MPU6050 or not... I only get -1. That's really frustrating considering that all the tutorials I have watched achieve to retrieve data.
To begin with, I connected the MPU6050 with the arduino like so :
Then I used the official code https://playground.arduino.cc/Main/MPU-6050#short
that is to say this one :
And that's what I get ...
I bought a new one, but I still have the same issue...
If someone has any Idea, I would really appreciate !
Thanks
How do you know the I2C device address is correct? You could try scanning the bus to discover all the devices and their addresses. That would confirm your bus setup is working as well. Found this quick guide on accomplishing this: http://henrysbench.capnfatz.com/henrys-bench/arduino-projects-tips-and-more/arduino-quick-tip-find-your-i2c-address/
"The I2C-address depends on the AD0 pin of the sensor. If it is connected to ground, the address is 0x68. If it is connected to VLOGIC (+3.3V) it is 0x69. There are a few sensor boards with the MPU-6050 sensor already soldered on it."
So it is indeed necessary to solder the pins. We didn't thought about this because we connected VCC and GND without soldering as well and the LED was working fine whereby we assumed that it should be enough to stick them together for now. Seems like we were wrong and I've got now three working gyros at home.

PWM/PPM Output misses some edges

I am using ESP8266 (NODEMCU 3.0 or something) to make a quadcopter. Ive connected ardu pro mini to RC receiver so I am reading PPM values from it. Pro mini sends data with tx to ESP8266. ESP reads it with software serial with 115200 baudrate. I am communicating with MPU9255 (Waveshire) via I2C either.
My problem is that I cant fully controll my brushless motors. When I was using arduino instead of ESP8266, servo library was the best and reliable. But ESP's servo library is different, since its not AVR, and problems occurs. First of the servo library didnt want to work on most frequencies. I mean default is 50Hz (20000uS) and in this state ESC of motors did armed but unfortunatelly when changes was fast and short (1250-> 1370 -> 1250) it did miss that change like nothing happnd... This makes my D value in PID controller useless...
Sometimes on 100Hz freq all was working fine, but sometimes not...
When Ive started to use analogWrite only 500Hz was working fine, rest of freq didnt want to arm ESCs.
PS. I am using 3.3V to 5V converter for PPM/PWM pins so I am sure that the signal is fine for ESCs.
PS2. I dont have any osciloscope unfortunately.
The ESP82266 present on your module is a RF transceiver integrated circuit that can handle WiFi communication, both configured as a slave to a microcontroller such as the ones present on various Arduino boards, or as a standalone chip by having it's on-board Tensilica L106 32-bit processor programmed via an external SPI flash memory. If used as a slave, the communication between, for example, an Arduino an the ESP82266 can be done using different protocols such as SPI / SDIO or I2C / UART interfaces. Googling a comprehensive Tensilica L106 user guide on the internet doesn't seem an easy task, and it looks as if some people have already failed to find it. If you're seeking to add Wi-Fi capabilities to your quadcopter the solution I suggest is having the Arduino take control over the servos, motors, etc. and hand off messages via SPI to your ESP82266 module. If this isn't the answer you are looking for, please try to be clearer about it, maybe find someone to do as an English translator for you.
However, if this is what you're concerned about, and you would like to use the ESP82266 module as as standalone solution, please link its built-in processor datasheet and the relevant parts of the quadcopters code that might need debugging.

ESP8266 Point to Point communication with 2 arduinos

I am using 2 esp8266 wireless modules to establish bidirectional wireless communication between 2 arduino boards (one mega and one uno) without the use of any earth based technologies (i.e. radio frequencies, wifi which relies on earth sattelites, etc.). My solution was to use the esp8266 to establish a private area network with both esp's acting as a station and an access point (AT+CIPMODE=3). Unfortunately, this solution has proven to be more of a hassle than it was worth.
To start, I have the esp's each wired according to this diagram
When I first started out, the red LED was on and the blue LED was off. During this time, I was able to send AT commands, establish the server, and achieve the communication I required by entering commands directly to the serial monitor. After this, I started writing a library using the SoftwareSerial library to allow me to issue commands directly through the program to set up the esp as needed upon start up of my script. Before doing this, I changed the baudrate to make sure it was running at 9600, and entered the AT commands in the serial monitor to make sure everything was working properly and it still worked.
After I began writing the library, before uploading the code with a test of the library I noticed the blue LED was lit solid now. Noticing this, I reuploaded the barebones script (I haven't uploaded the library code to the arduino yet) and the esp was no longer receiving the AT commands.
Does this indicate an issue with the board which I can fix or does this mean the board is done?
With my deadlines approaching fast in about 3 weeks it is crucial I get this wireless communication working so if this is an issue with the board, I'm going to have to scrap the esp's and use a different way of communicating. So my second question is, if this is the case, what are other viable options for establishing this communication? I have used xbee's before and while that would be ideal, they fall out of the budget I have been alotted so I need to keep it under $50 for this. If bidirectional communication is not possible for that price I can live with one way because I just need to get this system working. Basically I just need to transmit a single byte of data.
I realize this response is a little belated, and I hope you got it sorted: I've started working with the ESP8266 myself in the last few weeks, and hence why I was looking around for tutorials on direct communication between 2 units, when I found your post.
From what I've been able to ascertain, the AT commands are a part of the 'firmware' which ships with some modules. The Arduino code however starts loading onto the chips at memory address 0x0000, which is the same address that the firmware update tools use.
In other words, I believe that with the Arduino-coded program running on there, you lose the AT command functionality.
If you find a firmware update tool for the ESP8266 (plenty online) you'll get back the AT commands.
I suppose though the real question is why would you want to? It seems that the AT commands are just a way to treat the ESP as a dumb WiFi antenna. With the Arduino code, you're actually treating it as a micro-controller in its own right.

STM32F103VCT6 UART to FTDI Interface issue

ok guys, this is probably one of the most stupid things I have gotten stuck at so far but I have a problem.
I have an STM32F103VCT6 mcu, and I am trying to communicate over USART1, thats PA09 and PA10.
Tx line sends just fine to connected FTDI chip and all appears well on the computer terminal.
The problem is that the Rx IT on the stm wont fire when FTDI sends data.
Rx line PA10 is configured as GPIO_Mode_IN_FLOATING.
I have tried to change voltage levels of chip, still nothing.
The really funny thing is, if I connect the Rx and Tx of the stm, the interrupt works just fine.
If I connect the Rx line of the the stm to any other point on the board, it fires no problem (reading rubbish of course, but at least I know my firmware works)
I have stm, ftdi and computer all connected to common grounds so that shouldnt be an issue.
I have also confirmed a million times that my jumper cables are in good shape and nothing is broken.
Bottom line is I know its an electric problem that I just cant get my head around ... its just one of those days/things, so if anyone has struggled with the same issue or something similar please let me know how you solved this !!
Thanks alot guys

Resources