raspberrypibeginer
Posts: 46
Joined: Sun Jan 04, 2015 11:38 pm

Raspberry pi and arduino

Sun Jan 11, 2015 6:14 pm

Hello,can I use the arduino as serial to usb for the raspberry pi,for program it without a screen,please help me

User avatar
topguy
Posts: 6491
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Raspberry pi and arduino

Sun Jan 11, 2015 6:18 pm

raspberrypibeginer wrote:Hello,can I use the arduino as serial to usb for the raspberry pi,for program it without a screen,please help me
You want to program the Arduino or the Raspberry ??
I think you should try to explain a little more in detail what you want to try to do.

raspberrypibeginer
Posts: 46
Joined: Sun Jan 04, 2015 11:38 pm

Re: Raspberry pi and arduino

Sun Jan 11, 2015 6:19 pm

I want to program raspberry pi

User avatar
mikronauts
Posts: 2783
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: Raspberry pi and arduino

Sun Jan 11, 2015 6:22 pm

No.

Your best bet is get the Pi set up with screen & keyboard, then install xrdp, and use remmina or other tablet/desktop/notebook rdp client to connect to the Pi.
raspberrypibeginer wrote:Hello,can I use the arduino as serial to usb for the raspberry pi,for program it without a screen,please help me
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

RetiredProgrammer
Posts: 14
Joined: Sat Jan 10, 2015 10:42 pm

Re: Raspberry pi and arduino

Sun Jan 11, 2015 7:31 pm

raspberrypibeginer wrote:Hello,can I use the arduino as serial to usb for the raspberry pi,for program it without a screen,please help me
Yes- I am doing the same thing. Windows laptop running remote desktop to RPi (running vncserver) with Arduino attached to RPi via USB. Run the Arduino via the Arduino IDE and activate the serial monitor in the IDE. Serial.print in your Arduino sketch will appear on your remote desk top.

A couple items to be aware of: Be sure you have the right board selected in the Arduino IDE and be sure the speed of Serial is the same in your sketch and in the serial monitor.

raspberrypibeginer
Posts: 46
Joined: Sun Jan 04, 2015 11:38 pm

Re: Raspberry pi and arduino

Sun Jan 11, 2015 10:43 pm

retired programer,can you teach me how to do it

raspberrypibeginer
Posts: 46
Joined: Sun Jan 04, 2015 11:38 pm

Re: Raspberry pi and arduino

Sun Jan 11, 2015 10:45 pm

I think that you dont understand me,I tried to say if I can conect arduino via tx,rx,gnd an the arduino to mi laptop

raspberrypibeginer
Posts: 46
Joined: Sun Jan 04, 2015 11:38 pm

Re: Raspberry pi and arduino

Sun Jan 11, 2015 10:50 pm

And if i cant do it with arduino,can anyone explain me how to use my laptop internet connection to use it with RPi via RJ45,because i dont have wifi dongle

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Raspberry pi and arduino

Sun Jan 11, 2015 11:10 pm

raspberrypibeginer wrote:And if i cant do it with arduino,can anyone explain me how to use my laptop internet connection to use it with RPi via RJ45,because i dont have wifi dongle
That's the easier option. Just bridge the connections on your laptop and wire the two together. Nothing special needed on the RPi for internet connection sharing.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
liudr
Posts: 687
Joined: Sat Jun 01, 2013 12:11 am
Location: Central MN, USA
Contact: Website

Re: Raspberry pi and arduino

Mon Jan 12, 2015 12:19 am

Trying to help and understand your issues here. You have raspberry pi and arduino is connected to raspberry pi TX RX GND? That alone won't work. Raspberry pi serial pins are 3.3v logic and arduino 5v. Plus, you need 5v from raspberry pi to arduino. What kind of project are you doing?
Arduino data loggers, user interface, printed circuit board designer since 2009, RPI 3B 2B 2B Zero Jessie, assembly/C/C++/java/python programmer since the 80's

raspberrypibeginer
Posts: 46
Joined: Sun Jan 04, 2015 11:38 pm

Re: Raspberry pi and arduino

Mon Jan 12, 2015 3:02 pm

Its a project that i need to program it without a screen,because i dont have screen

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Raspberry pi and arduino

Mon Jan 12, 2015 3:37 pm

Its two largely unrelated problems. You can connect the Pi to your router with the ethernet port and use SSH/VNC/Whatever to control / program /whatever the Pi from your existing computer. You can connect the Pi to the Arduino using USB or using the Pi's TTY serial on the GPIO pins to connect to the Arduino's TX/RX/Gnd. If you're using TX RX, you can connect the GND directly betwwen the Pi and the Arduino, The Pi's TX can be connected to the Arduino's RX directly, The Arduino TX must be reduced to 3.3 volts to connect to the Pi's RX, several ways of doing this, but the easiest is probably a voltage divider, which is what I use on my setup. I use a 10k and 18k resistor, but many values will work if the ratio is about right.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

raspberrypibeginer
Posts: 46
Joined: Sun Jan 04, 2015 11:38 pm

Re: Raspberry pi and arduino

Mon Jan 12, 2015 3:41 pm

but,can I convert the 5v to 3,3v with three 10k resistor,i'm correct?

raspberrypibeginer
Posts: 46
Joined: Sun Jan 04, 2015 11:38 pm

Re: Raspberry pi and arduino

Mon Jan 12, 2015 3:47 pm

the think im trying to say is if i can use arduino uno as serial to usb,because i think if you can conect tx,rx,gnd and power RPi and connect the arduino to the PC you can use a serial comunication,if i can reduce the voltage with resistor,this i think work perfectly but i don't know,if i'm not explain good is because i'm spanish,and i'm 13 years old,i'm entering to the electronics world :D

User avatar
panik
Posts: 369
Joined: Fri Sep 23, 2011 12:29 pm
Location: Netherlands

Re: Raspberry pi and arduino

Mon Jan 12, 2015 4:30 pm

So you want to use the Arduino as if it was an FTDI cable or similar to log into the Pi from your computer using serial? That's good thinking actually, pretty smart! There is USB CDC functionality available on the Arduino Uno. So why not use it?

Unfortunately, the Arduino (Uno) uses the 'Serial' class for both the USB CDC and the RX/TX on the D0 and D1 pins. So I'm afraid that's not possible.

If your Arduino was a Leonardo it's possible to pass data back and forth between 'Serial1' (pins D0 and D1) and 'Serial' (USB CDC). All this after you handled the 5V-3.3V conversion of course.

Your best bet now is probably to SSH into the Pi using your LAN network. Or connect directly as @DougieLawson suggests.
Microcontroller addon boards and software for Raspberry Pi A+/B+/Pi2:
- ARMinARM: ARM Cortex-M3 (STM32)
- AVRPi: ATmega32U4 & ATmega328 ("Arduino")
http://www.onandoffables.com

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Raspberry pi and arduino

Mon Jan 12, 2015 4:56 pm

raspberrypibeginer wrote:but,can I convert the 5v to 3,3v with three 10k resistor,i'm correct?
Yes 3 10k resistors would work.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Raspberry pi and arduino

Mon Jan 12, 2015 5:13 pm

raspberrypibeginer wrote:but,can I convert the 5v to 3,3v with three 10k resistor,i'm correct?
Yes you can two 10K (R1) resistors in series makes 20K (R2).
signal ----[10K]--- *GPIO pin* ---[10K]---[10K]---GND

Image
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Raspberry pi and arduino

Mon Jan 12, 2015 5:18 pm

it would almost certainly work with 2 10k resistors. 2.5 V would probably flag as a logic 1 on 3.3 volts
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

raspberrypibeginer
Posts: 46
Joined: Sun Jan 04, 2015 11:38 pm

Re: Raspberry pi and arduino

Mon Jan 12, 2015 6:08 pm

thanks to all,last question is if i can connect it with an RJ45 to a laptop and dont use internet connection to use an ssh server,like arduino,you plug it the RJ45 and you can use it without internet only command line

User avatar
panik
Posts: 369
Joined: Fri Sep 23, 2011 12:29 pm
Location: Netherlands

Re: Raspberry pi and arduino

Mon Jan 12, 2015 6:45 pm

panik wrote:Unfortunately, the Arduino (Uno) uses the 'Serial' class for both the USB CDC and the RX/TX on the D0 and D1 pins. So I'm afraid that's not possible.
After a meal and a second thought; you could use only the USB-serial part of the Arduino and bypass the ATmega328 completely.

Remove it from its socket so it doesn't interfere. Connect RX and TX from the Pi to pin D0 and D1 on the header (with the voltage divider). It's directly[*] connected to the ATmega8U2 on the Arduino board that does the USB-serial (it's an FTDI chip on older Arduinos). Should work in theory.

[*] Edit: there are two 1K resistors as well. See the schematic: http://arduino.cc/en/uploads/Main/ardui ... ematic.pdf

Edit2: Sorry for not answering your question. Probably yes, but I hope/think other people are able to give better comments on that. SSH is probably the easiest. I just think your original question (and proposed solution) was interesting.
Microcontroller addon boards and software for Raspberry Pi A+/B+/Pi2:
- ARMinARM: ARM Cortex-M3 (STM32)
- AVRPi: ATmega32U4 & ATmega328 ("Arduino")
http://www.onandoffables.com

RetiredProgrammer
Posts: 14
Joined: Sat Jan 10, 2015 10:42 pm

Re: Raspberry pi and arduino

Tue Jan 13, 2015 1:47 am

raspberrypibeginer wrote:And if i cant do it with arduino,can anyone explain me how to use my laptop internet connection to use it with RPi via RJ45,because i dont have wifi dongle
You can connect your RPi and your laptop with an Ethernet cable if you have an Ethernet connector on your laptop

Return to “Beginners”