2

I am developing a control system in my raspberry, but i have the problem that it doesn't have any analogue port, so if i use an arduino to convert de signal from analogue to digital and after send this signal into a I/o digital port from anduino to raspberry, thas is posible?

my plan was receive the analog signal in arduino and transforms here in a digital signal and after send it by Digital port to rasberry

asked Jun 13, 2019 at 19:27

1 Answer 1

1

It is not clear what you mean by "digital port". The simplest mean to communicate from the Arduino to the Raspberry is to use the Arduino's serial port, which gets into the Raspberry Pi through USB. Just like you would do if you had a PC instead of the Raspberry:

/*
 * Continuously report the analog readings on pins A0 through A2.
 */
void setup() {
 Serial.begin(9600);
}
void loop() {
 Serial.print("0 "); Serial.println(analogRead(A0));
 Serial.print("1 "); Serial.println(analogRead(A1));
 Serial.print("2 "); Serial.println(analogRead(A2));
}

This program will continuously output a text stream like this:

0 145
1 220
2 865
0 142
1 223
...

where the first column is the analog channel number and the second column is the ADC value. How you handle this stream on the Raspberry side is up to you.

answered Jun 13, 2019 at 19:40
4
  • i could manipulate this data in my rasberry? to make a controller? Commented Jun 13, 2019 at 19:44
  • 1
    @JesusMiguelHerrera: Of course! It's your data, you do whatever you want with it. Commented Jun 13, 2019 at 19:50
  • the last question, how could i activate the serial port in my raspberry with the goal of receive this signal? Commented Jun 13, 2019 at 19:52
  • @JesusMiguelHerrera: On the Raspberry side, the serial port (usually /dev/ttyACM0) is activated by connecting the USB cable. Commented Jun 13, 2019 at 19:54

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.