# Photon to Arduino serial data false

**URL:** <https://community.particle.io/t/photon-to-arduino-serial-data-false/25152>\
**Category:** Firmware\
**Created:** [August 15, 2016, 6:42pm UTC](https://community.particle.io/t/photon-to-arduino-serial-data-false/25152 "2016-08-15T18:42:11Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![JackD12](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@JackD12](https://community.particle.io/u/JackD12)\
**Post date:** [August 15, 2016, 6:42pm UTC](https://community.particle.io/t/photon-to-arduino-serial-data-false/25152/1 "2016-08-15T18:42:11Z")

</div>

Hi all, I’m using my Photon and Arduino board with tx/rx. What I’m trying to do is get my photon to send potentiometer data to my Arduino uno via tx/rx… I have a logic level shifter to shift the signals ( [https://learn.sparkfun.com/tutorials/bi-directional-logic-level-converter-hookup-guide](https://learn.sparkfun.com/tutorials/bi-directional-logic-level-converter-hookup-guide))and I run tx and rx through it; while I connect the ground. For some reason this will not work. The strange thing is it will work on Photon’s even when one is 3.3, and the other 5v while I use the same logic level converter; the data makes sense, so this must be the Arduino messing with me because it works when I do this with my photons. My goal is to get the data from the Photon to print in my Arduino’s serial monitor. This has been confusing me for a while now…

Photon code:

```auto
void setup() {
Serial1.begin(9600);

}

void loop() {
int data = analogRead(A0)/ 4;

delay(400);
Serial1.println("Hello World, this is my value");
delay(400);
Serial1.println(data);
}

Arduino code:

int incomingByte = 0;   

void setup() {
        Serial.begin(9600);     
}
void loop() {

        if (Serial.available() > 0) {
                // read the incoming byte:
                incomingByte = Serial.read();

                Serial.print("received, ");
                Serial.println(incomingByte, DEC);
        }
}

```

If anyone would like me to clarify I would be happy to do so. My goal is to get the data from the Photon to print in my Arduino’s serial monitor

Jack

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [August 15, 2016, 6:59pm UTC](https://community.particle.io/t/photon-to-arduino-serial-data-false/25152/2 "2016-08-15T18:59:52Z")

</div>

@JackD12, the code on the arduino seems to be receiving on Serial and then printing to Serial (back to Photon). Is this what you intended?

---

<div class="post-metadata">

**Author:** ![JackD12](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@JackD12](https://community.particle.io/u/JackD12)\
**Post date:** [August 15, 2016, 7:12pm UTC](https://community.particle.io/t/photon-to-arduino-serial-data-false/25152/3 "2016-08-15T19:12:34Z")

</div>

Um no but that’s a good point @peekay123

---

<div class="post-metadata">

**Author:** ![JackD12](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@JackD12](https://community.particle.io/u/JackD12)\
**Post date:** [August 15, 2016, 7:13pm UTC](https://community.particle.io/t/photon-to-arduino-serial-data-false/25152/4 "2016-08-15T19:13:16Z")

</div>

I meant for that data to printed in Arduino’s serial monitor

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [August 15, 2016, 7:15pm UTC](https://community.particle.io/t/photon-to-arduino-serial-data-false/25152/5 "2016-08-15T19:15:11Z")

</div>

@JackD12, you can’t do both! You can have the serial monitor connected but need a second serial port to communicate with the Photon. You may want to consider using SoftwareSerial for connecting to the Photon.

---

<div class="post-metadata">

**Author:** ![JackD12](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@JackD12](https://community.particle.io/u/JackD12)\
**Post date:** [August 15, 2016, 7:19pm UTC](https://community.particle.io/t/photon-to-arduino-serial-data-false/25152/6 "2016-08-15T19:19:48Z")

</div>

Would that explain the false data? @peekay123

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [August 15, 2016, 7:25pm UTC](https://community.particle.io/t/photon-to-arduino-serial-data-false/25152/7 "2016-08-15T19:25:02Z")

</div>

@JackD12, what do you mean by “false data”? From what I understand, you can do Photon to Photon even with the level shifter, correct? For the Arduino are the TX and RX lines crossed going to the Arduino TX and RX lines?

Using the serial monitor while being connected to the Photon may cause problems. This is why I suggest using SoftwareSerial to create a second serial port. That way you can keep the serial monitor on the USB and have software serial create a new port for the Photon which will not interfere.

---

<div class="post-metadata">

**Author:** ![JackD12](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@JackD12](https://community.particle.io/u/JackD12)\
**Post date:** [August 15, 2016, 7:30pm UTC](https://community.particle.io/t/photon-to-arduino-serial-data-false/25152/8 "2016-08-15T19:30:24Z")

</div>

By false data I mean the numbers that show up in Arduino’s serial monitor; but I know its false because it’s absolutely crazy! And yes I double checked my connections for tx/rx. Do you mean Software Serial on arduino or Photon (Sorry I’m not very good with the SoftwareSerial library 😂 )

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [August 15, 2016, 7:34pm UTC](https://community.particle.io/t/photon-to-arduino-serial-data-false/25152/9 "2016-08-15T19:34:11Z")

</div>

@JackD12, trying to use the Serial monitor and the RX/TX lines on the Arduino at the same time could produce that false data. SoftwareSerial is a standard Arduino library that allows you create a serial port from 2 GPIO pins you designate. It is very easy to use. It creates a serial port that you could use much like Photon’s Serial1 port.

So on the Arduino side, you would read from the SoftwareSerial port you created and send it to the Serial port for display on the serial monitor.

---

<div class="post-metadata">

**Author:** ![JackD12](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@JackD12](https://community.particle.io/u/JackD12)\
**Post date:** [August 15, 2016, 7:42pm UTC](https://community.particle.io/t/photon-to-arduino-serial-data-false/25152/10 "2016-08-15T19:42:11Z")

</div>

Ok, so instead of putting the tx and rx pins from the photon I would put them on whatever pins I designate and allowed for SoftwareSerial, then take the value from the designated pin(s) and print it in the Arduino serial monitor. Correct @peekay123 ?

And my Arduino code above would no longer be needed i could just use the Arduino example “Two Port Receive”

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [August 15, 2016, 7:49pm UTC](https://community.particle.io/t/photon-to-arduino-serial-data-false/25152/11 "2016-08-15T19:49:40Z")

</div>

@JackD12, yup. Without looking at the “two port receive” example, I can’t confirm but I think you’re on the right track. 😉

---

<div class="post-metadata">

**Author:** ![JackD12](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@JackD12](https://community.particle.io/u/JackD12)\
**Post date:** [August 15, 2016, 7:50pm UTC](https://community.particle.io/t/photon-to-arduino-serial-data-false/25152/12 "2016-08-15T19:50:23Z")

</div>

Thanks @peekay123 it’s starting to work a heck of a lot better!!! 😀  
The data finally makes sense!

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [August 15, 2016, 7:55pm UTC](https://community.particle.io/t/photon-to-arduino-serial-data-false/25152/13 "2016-08-15T19:55:17Z")

</div>

@JackD12, don’t you love it when a plan comes together!

---

<div class="post-metadata">

**Author:** ![JackD12](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@JackD12](https://community.particle.io/u/JackD12)\
**Post date:** [August 15, 2016, 7:58pm UTC](https://community.particle.io/t/photon-to-arduino-serial-data-false/25152/14 "2016-08-15T19:58:58Z")

</div>

Absolutely, I never would’ve figured that one out on my own! 😆
