Sent and receive data from arduberry


#1

Hello All,

I have device set up like a combination of Raspberry Pi, Arduberry and adafruit nfc sheild. Does this disable serial port?

I wonder how can I make Arduberry talk to Raspberry Pi?

I tried
void setup()
{
Serial.begin(115200); //Start the Serial at 9600 baud
}

void loop()
{
if(Serial.read()==‘s’) //If ‘s’ is recieved, send the data back
{
int sensorValue = analogRead(A0);
Serial.print(“Hi”);
Serial.println(sensorValue); //Send ‘hi’ followed by the analog read value
}
delay(1000);
}


#2

Hi @shaow1,

Is the baud rate 9600, I think you have chosen 115200 as the baud rate so change it to Serial.begin(9600), also can you send us a screenshot of the output you see.Can you check if the serial monitor is working by adding Serial.println("Hello World") after the delay(1000) in your program.
Are you getting the LED Blink program to work with ArduBerry?

-Shoban


#3

What LED Blink program? I am not using any of those port like COM1, so nothing is there in serial monitor. My device is set up like the following link (dexterindustries.com/Arduberry/example-projects-with-arduberry-and-raspberry-pi/nfc-card-reader/)


#4

Hi @shaow1,

Sorry I meant, what you see on your minicom, Have you tried changing the baud rate to 9600 ?
Have you tried this LED blink program. LED blink program is to know if your ArduBerry works and the aim of adding the Serial print statement is to see if Serial print works on minicom.

-Shoban


#5

I am trying this, but the python code says serialException something like that and device disconnect. Here is the link “dexterindustries.com/Arduberry/how-to-program-the-arduberry/python-communicating-arduberry/


#6

Hi @shaow1,

We haven’t seen this trouble before, we will look into it and get back shortly.

-Shoban


#7

Couple things I want make sure, first of all, in the first link, it uses Arduberry v1, but mine is Arduberry v7.0 does that matter?
Second, does the python communication using USB connection?
Third, the ttyAMA0 that we used for NFC detection(read data), can I also use it for sending data? Will it cause conflict?


#8

@shaow1,
There should not be any difference between the way v1 and v7 work.

The Python comms with the Arduberry work with serial via the 26 or 40 pin GPIO header. USB is only for power.

Only one serial device can be used on ttyAMA0. So there will be a conflict if you want to talk between the Pi and Arduberry via Serial.


#9

So any suggestions for my situation? I am already using ttyAMA0 for the NFC receive data, so how will I be able to send those data to the Raspberry Pi? Do you thing python works or I should pick another language?


#10

@shaow1,
There is not a great way to use multiple serial devices. One way can be to use a serial Mux like this which would allow you to connect to multiple devices.

The other way can be to use an serial to USB adapter like this which would allow you to connect the second serial device to the USB port.

Can you send me a link to the NFC module that you are using.


#11

https://www.dexterindustries.com/Arduberry/example-projects-with-arduberry-and-raspberry-pi/nfc-card-reader/

This one.


#12

@shaow1,
This NFC shield can also be connected via I2C. Would you be comfortable soldering a few pads and making a few changes on the code so that it can work over I2C.


#13

Hey Karan,

I solved this problem, the conflict is actually caused by having minicom open.

Now I wonder how can I detect


this specific tag?


#14

@shaow1,
Great to hear that it is working for you now. I am not really sure how to detect that particular NFC tag. Can you check the specs of that one and see if the NFC shield supports it. Usually the NFC shield is able to read the tag as soon as the tag is brought close to it.


#15

Any code I need change in order to make it work for different tags? Also for the example code for this specific set up, how can I change the tag’s ID?