Menu
Arduino Uno with Multiple Software Serial Devices. The Arduino Uno. It is called SoftwareSerial.h and is included with the latest Arduino IDE. The following code. Sends to the hardware serial port. In order to listen on a.
The only thing better than sending signals to Processing is sending multiple signals, right? Sending multiple signals is often a stumbling block, though, because although sending values from multiple sensors is easy, handling them in the correct order on the other end can often be difficult.
You need:
- An Arduino Uno
- A breadboard
- Two 10k ohm potentiometers
- A pushbutton
- A 10k ohm resistor
- Jump wires
The circuit is a combination of three separate inputs. Although they all use the same power and ground, you can think of the inputs individually. Two potentiometers provide two values. These are wired in the same way you would wire a temperature sensor, with one side wired to 5V and the other wired to the analog input pin that is reading it as well as to GND via a resistor.
These could actually be replaced with any analog inputs with the appropriate resistors. The pushbutton provides a digital input as well. One side of the pushbutton is wired to 5V and the other is wired to the digital pin reading it as well as GND via a resistor.
How to set up the Arduino code
After you assemble your circuit, you need the appropriate software to use it. From the Arduino menu, choose File→Examples→04.Communication→SerialCallResponse. This sketch contains both Arduino code and the relevant Processing code for the sketch to work. The Processing code beneath the Arduino code is commented out to avoid interference with the Arduino sketch.
Upload this code to your Arduino.
How to set up the Processing code
You find the Processing code within multiline comment markers (/* */) at the bottom of the Arduino SerialCallResponse sketch. Copy the code within the comment markers into a new Processing sketch and save with an appropriate name.
Click the Run button to execute the Processing sketch, and an applet appears. The applet has a black background, and whenever you press the pushbutton, a white dot appears. Move the potentiometers to move the dot horizontally and vertically. When you release the pushbutton, the dot disappears.
Introduction: CONNECTING MULTIPLE SENSORS TO ONE ARDUINO UNO SERIAL PORT
In this tutorial, we will be expanding a single Arduino UNO UART (Rx/Tx) serial port so that multiple Atlas sensors can be connected. The expansion is done using 8:1 Serial Port Expander board. The Arduino's port is linked to the expander after which the signal is routed to the eight ports where the peripheral devices are connected. For simplicity purposes, we will be utilizing three ports, but with a few more steps, you can make the expansion to use all eight.
Communication is done via UART mode, and the results are displayed on the Arduino serial monitor. By default, the readings of the connected sensors are polled continuously. Individual channels can then be opened, which will allow the user to communicate with a specific sensor.
ADVANTAGES:
- Expand a single UART (Rx/Tx) serial port into eight additional ports.
- Easily keep tabs on which channel is opened through the onboard LEDs on the Expander module.
- Works with the following Atlas Scientific's EZO sensors: pH, salinity, dissolved oxygen (DO), temperature, oxidation-reduction potential (ORP), CO2, peristaltic pump.
- Real-time sensor output
MATERIALS:
- Breadboard
- Jumper wires
- 1- EZO dissolved oxygen circuit and 1- dissolved oxygen probe
- 1- EZO conductivity circuit and 1- conductivity k1.0 probe
- 1- EZO pH circuit and 1- pH probe
- 1- 8:1 Serial Port Expander
- 2- Inline voltage isolators
- 3- Female BNC connectors
Teacher Notes
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: ASSEMBLE HARDWARE
Assemble the hardware as shown in the schematic above.
Ensure that the sensors are in UART mode before connecting them to the Expander. For information on how to change between protocols refer to the following LINK.
The sensitivity of the sensors is what gives them their high accuracy. But this also means that they are subjected to interference from other electronics and as such electrical isolation is needed. Voltage isolators are used to isolate the dissolved oxygen and pH sensors from the salinity sensor. Without the isolators, readings are erratic. For more information on isolation refer to the following LINK.
DATASHEETS:
Step 2: LOAD PROGRAM ONTO ARDUINO
The code for this tutorial makes use of a customized library and header file for the EZO circuits in UART mode. You will have to add them to your Arduino IDE to use the code. The steps below include the process of making the addition to the IDE.
a) Download Ezo_uart_lib, a zip folder from GitHub onto your computer.
b) On your computer, open the Arduino IDE (you can download the IDE from HERE if you do not have it).
c) In the IDE, go to Sketch -> Include Library -> Add .ZIP Library -> Select the Ezo_uart_lib folder you just downloaded. The appropriate files are now included.
d) Copy the code from Serial_port_expander_example onto your IDE work panel. You can also access it from the Ezo_uart_lib folder downloaded above.
e) Compile and upload the Serial_port_expander_example code to your Arduino Uno.
f) The serial monitor is used as the conduit of communication. To open the serial monitor, go to Tools -> Serial Monitor or press Ctrl+Shift+M on the keyboard. Set the baud rate to 9600 and select 'Carriage return.' The readings of the sensor should now be constantly displaying, and the user will be able to interact with individual sensors.
Step 3: MONITOR READINGS AND INTERACT WITH SENSORS
To open a channel denoted by P1- P8 on the Expander board, send the channel number followed by a colon and the command (if any). End the string with a carriage return (ENTER key on the keyboard). For example, 3:i will open channel three and request the device information.
To open a channel and not send a command just input the channel number followed by a colon. End the string with a carriage return (ENTER key on the keyboard). For example, 2: will open channel two. You can now send any commands specific to that sensor such as cal,? which will report calibration information. Refer to the sensors' datasheets for the list of commands.
![Arduino Multiple Serial Data Arduino Multiple Serial Data](http://fablab.ruc.dk/content/images/2014/Aug/Screen-Shot-2014-08-04-at-14-45-48.png)
Step 4: TAKING IT FURTHER
As shown, we have only utilized three out of the eight ports. To use more ports, follow the wiring scheme shown in step 1 and expand to ports 4, port 5 and so on. Incorporate isolators when necessary. The sample code, Serial_port_expander_example will also need some modification. Refer to the comments within the code for guidance.
Be the First to Share
Recommendations
164 12K
Arduino RGB Color Picker – Pick Colors From Real Life Objects in Arduino
Cat Food Access Control (ESP8266 + Servo Motor + 3D Printing) in Arduino
Raspberry Pi Contest 2020
Wearables Contest
Fix It Contest