Dawn Robotics Forum Support and community forums for Dawn Robotics Ltd 2014-12-29T12:53:10+01:00 http://forum.dawnrobotics.co.uk/feed.php?f=15&t=1296 2014-12-29T12:53:10+01:00 2014-12-29T12:53:10+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1296&p=1564#p1564 <![CDATA[Re: Raspberry Pi and co-op communication.]]>
Arduino pin naming can be a bit confusing I'm afraid, especially because it bears bery little relation to the numbering of pins on the microcontroller (which is what you see on the schematic).

The microcontroller on the Pi Co-op is an Atmel Atmega328, and you can download its datasheet here. In the datasheet you can see a pinout for the microcontroller, and these pin numbers are the ones that you see on the schematic. The diagram on this page shows the pin mapping from microcontroller pins to Arduino pins. This is largely arbitrary and was chosen by the people who wrote the Arduino libraries.

When using PyMata, you would just use the Arduino pin numbers, and software further down (on the Pi Co-op) will work out how to translate the pin numbers properly. PyMata will usually be able to work out whether 2 refers to digital pin 2, or A2 by the function you're calling, or other parameters. So for example, when you called set_pin_mode, you also said that the pin was analog so it knew to use A0. If you want to use A0 as a digital input you'd need to pass in 14 as the pin. This is calculated by using the table on this page.

Hope this is of some help, and not too confusing. :)

Regards

Alan

Statistics: Posted by Alan — Mon Dec 29, 2014 12:53 pm


]]>
2014-12-28T23:54:29+01:00 2014-12-28T23:54:29+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1296&p=1559#p1559 <![CDATA[Re: Raspberry Pi and co-op communication.]]>
I have tried to continue with my project and have become slightly confused with the schematic and the numbering system which python uses.

I have the code:
POTENTIOMETER = 0
firmata.set_pin_mode(POTENTIOMETER, firmata.INPUT, firmata.ANALOG)

Which I have adapted from on-line, my potentiometer is connected to A0 and I there is no indication on the schematic that A0 was 0. From the schematic I thought it was pin 23. I am confused to how the schematic relates to the referencing within Python. For example on the pi co-op board there is A2 and 2, so am slightly confused which one would be 2.

Any help would be appreciated.

Statistics: Posted by Maximus789 — Sun Dec 28, 2014 11:54 pm


]]>
2014-12-11T11:42:04+01:00 2014-12-11T11:42:04+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1296&p=1525#p1525 <![CDATA[Re: Raspberry Pi and co-op communication.]]>
The schematic linked to earlier also shows the LED attached to pin 13 (marked on the schematic as SCK).

Having an LED attached to pin 13 is fairly standard for an Arduino. It does make it harder to use it as an input but it's still possible, see here for details.

Regards

Alan

Statistics: Posted by Alan — Thu Dec 11, 2014 11:42 am


]]>
2014-12-11T11:32:03+01:00 2014-12-11T11:32:03+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1296&p=1524#p1524 <![CDATA[Re: Raspberry Pi and co-op communication.]]>
I have just noticed that when you have an LED in pin 13 and the reset button is pressed it gives it an out put. Does this mean that an input should not be placed into pin 13? Is there a schematic for the pins on the co-op?

Max

Statistics: Posted by Maximus789 — Thu Dec 11, 2014 11:32 am


]]>
2014-12-11T11:24:31+01:00 2014-12-11T11:24:31+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1296&p=1523#p1523 <![CDATA[Re: Raspberry Pi and co-op communication.]]>
Welcome to the forum. :)

You can see the pins that are used by the Pi Co-op by looking at the schematic linked to on the product page, and then comparing it to the Pi GPIO pins. It can be a bit hard to read if you're not used to schematics, but the important part to look at is the 13x2 connector in the bottom left corner. This shows that the pins used are the TX and RX lines (the serial UART lines on the Pi GPIO), along with GPIO 22 which is used to trigger the RESET line of the Atmega328 pin.

All of the other GPIO pins are free for you to use, and the 5V, 3.3V and GND pins can be shared between the Pi Co-op and other peripherals.

In terms of 'sharing variables' i.e. reading sensor with a Pi and controlling a servo with the Co-op this should be really easy with PyMata as you can load up both PyMata and the RPi.GPIO library at the same time. If you've written your own Arduino sketch for the Pi Co-op then it's still possible, you just need to use a library like PySerial to pass data to and from the Pi Co-op over a serial connection.

Hope that helps. If you need more detail on any area, please let me know.

Regards

Alan

Statistics: Posted by Alan — Thu Dec 11, 2014 11:24 am


]]>
2014-12-11T10:28:27+01:00 2014-12-11T10:28:27+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1296&p=1522#p1522 <![CDATA[Raspberry Pi and co-op communication.]]>
I was hoping someone would be able to clarify what pins are used to communicate between the co-op and the pi? Does this mean the remaining pins are all available to use as normal?

I have got the board up and running using the examples which were simple even for a noob :oops: !

I haven't tried, but is it possible to use share variables in real time? For example connecting a sensor to the Pi and using co-op to control a servo?

Any help will be much appreciated

Max

Statistics: Posted by Maximus789 — Thu Dec 11, 2014 10:28 am


]]>