Raspberry Pi and Arduino


The Raspberry Pi is great at being anything Linux can be; The Arduino is not though- even though many people have tried.

Why am I using an Arduino then? Linux is not a real time operating system - It is event driven and processes
Raspberry Pi Server Essentials Book
Buy Raspberry Pi Server Essentials.
Contains some information
about this article. 
 have to queue up before they are dealt with, even  the GPIO. This is unacceptable for my weather station project - because the anemometer in  the weather station is a simple switch (1 per revolution) and we have to count those triggers  in real time with high accuracy.

The Arduino is very good at handling real time events like this. Thanks to that the wind speed will be precise- even at 100mph gusts. It can also handle analog signals that the Raspberry lacks. It is actually an Atmega168/328 that uses the Arduino boot loader- so i can use the Arudino IDE and all the libraries to help me handle these real time devices.It also has a full UART.

Time to choose


  • What I have done is bought a Boarduino from ebay- ditched the voltage regulator and leach of the 3V3 from the Pi - The Atmega can run happily on that and best of all the UART will be at 3.3v - instead of the dreaded 5V that needs to be buffered. (In the breadboard i have a HCF4050 buffer - Because I thought I needed it, which I would have if it was powered at 5 Volts- So good riddance)
  • I found the wyolum alamode and decided to buy that instead. It is designed to sit on top of the Raspberry Pi and has the same Arduino chip on it, with a buffer for protection and many pinouts. It is just easier to use. If you want, you can make your own for the fraction of the price using the boarduino approach.


I connected the Atmega UART to the Pi's GPIO UART and now I just need to do 4 things.

  1. Disable the ROOT Console that is redirected to that UART on the Pi
  2. Make a program/script in python(easiest i suppose??) that reads the UART
  3. Install basic php webserver that will read the python aka UART- make sense of the data. (possibly log to mysql) and output it as a JSON string. (later make it more complex)
  4. Connect the Pi to the Internet via WiFi (later even GPRS) - Insulate the Electronics somehow and put it outside in the harsh Brittish winds and rains. Leave it over winter- Lets see how long it lasts :)

I am  was will(arrgh) making my own breakout board for this that I will available for sale at a reasonable price. It will include the Atmega- loaded with the weather sketch, the RJ-11 connectors + extra - for Sparkfun's weather system. It will just plug on top of the Pi - It will not be programmable but using a Boarduino you can do what you want to it later...




To be continued ...


Comments

Anonymous said…
hows this coming along?