jfeeney
Posts: 14
Joined: Wed Feb 15, 2012 11:09 pm

Re: Connecting PI to either a Netduino or Arduino board

Thu Mar 08, 2012 12:17 pm

I have a netduino board. I have an RPI on order. I have trying to do some research on the best way to connect my Netduino to my Raspberry PI.

Initially, I thought I would just connect using a serial connection from the GPIO pins on my PI (TX, RD) to my Netduino pins for TX, RD.

However, the more I research this the more confused I am getting. I run into terms for SerialPort, I2C, UART, etc.

From the Netduino forums I know that Netduino can't be a I2C slave.

I want my setup to be where my control program is installed on the Raspberry PI...which has the keyboard and monitor...and my Netduino to have the sensors or servo motors etc hooked up and running.

I would like to be able to adjust a setting (example: change high temperature from 75 to 85 degree) on Raspberry PI and then the Raspberry sends this to Netudino. Also, from time to time the Netduino sends back changes from the sensors it has hooked to it.

How would you go about doing this?

Thanks, John

User avatar
hayesey
Posts: 78
Joined: Mon Nov 28, 2011 12:46 pm
Location: Manchester, England

Re: Connecting PI to either a Netduino or Arduino board

Thu Mar 08, 2012 12:50 pm

does a netduino not have a usb port like an arduino does?  I'd have thought just connecting it like that would be the best method.

Chris.Rowland
Posts: 239
Joined: Thu Jan 12, 2012 5:45 pm

Re: Connecting PI to either a Netduino or Arduino board

Thu Mar 08, 2012 1:11 pm

I connect a PC to an Arduino using RS232, it looks like a serial port.  The Pi should connect the same way, with the Pi as the master and the Arduino or netduino as the slave.

jfeeney
Posts: 14
Joined: Wed Feb 15, 2012 11:09 pm

Re: Connecting PI to either a Netduino or Arduino board

Thu Mar 08, 2012 2:04 pm

One thing I did not mention in my original question was that I was hoping to use Mono on my Raspberry PI...this would allow me to do .Net C# programming on both my Netduino and Raspberry PI.

However, Mono does not support the ability to create an event handler on the Serial Port. I have posted the question on Mono to see if this was corrected and the responses coming back say that it is not.

So, I either have to come up with a solution that does not use the System.IO.Ports namespace that is in .Net or choose a different programming language such as Phyton?? that does support the SerialPort listening.

Can anyone suggest a method of communication between PI and Netduino that would not need the System.IO.Ports so that I could stay using Mono and C#?

Or if I had to use another programming language method....what would someone suggest?

Thanks, John

error404
Posts: 351
Joined: Wed Dec 21, 2011 11:49 pm

Re: Connecting PI to either a Netduino or Arduino board

Thu Mar 08, 2012 6:48 pm

It wouldn't be platform agnostic, but you could probably use the UNIX file semantics and some calls to the 'setserial' command to interact with the serial port. Or you could run a serial->TCP/IP gateway software and connect to it using a socket. Don't know much about .NET on Linux though, so maybe there's a better way.

Should be possible to write an I2C slave if you really wanted to, but probably more trouble than it's worth.

As far as another programming language, Python (with PySerial) would be a fine choice. See http://pyserial.sourceforge.net/ for examples. You won't get an event-based API for 'free' though, it's of course possible, but you'd have to implement that yourself. If you want to do event-based development on Linux, Qt might have something for you.

emg
Posts: 88
Joined: Wed Jan 11, 2012 11:01 pm

Re: Connecting PI to either a Netduino or Arduino board

Thu Mar 08, 2012 11:26 pm

I'm looking to do something similar as well with a Netduino and RPi. During previous research, I think there are Mono–>Python libraries you can access from mono (see Iron Python). As the RPi has been delayed, I've moved on to working with just the Netduino for my project and using Ethernet (UDP protocol specifically) to control the Netduino functionality from my PC with the aim to move my .net controlling application (currently running under windows) to the RPi and Mono.

Depending on your requirements, can you accomplish what you want via Ethernet by connecting both to the same switch?

(Edit: added link to Iron Python)

jfeeney
Posts: 14
Joined: Wed Feb 15, 2012 11:09 pm

Re: Connecting PI to either a Netduino or Arduino board

Sun Mar 18, 2012 6:25 pm

Is anyone familar with twisted being used with pyserial.

http://www.koders.com/python/f.....aspx?s=gtk

I am wondering if it is possible to use this type of code on the Raspberry PI?

John

Return to “General discussion”