Real Raspberry Pi - Why Pi?
Written by Harry Fairhead   
Thursday, 07 August 2014
Article Index
Real Raspberry Pi - Why Pi?
Python on Pi

 

Looking beyond Linux, the software that you are likely to find useful is Python for programming and a range of servers such as Apache and so on to help you set up infrastructure

Why Python?

One lazy reason is that is Python 2 and 3 are already installed and you simply use them. A better reason is that Python has the ability to work with the hardware - the GPIO and other types of interface such as I2C and son on. It also has a lot of standard libraries that let you do thing that go well beyond what you could do with a microcontroller such as the Arduino. 

However there are alternatives.

Currently the one that you are mostly likely to hear about is Java. There is an implementation of Java Embedded for the Raspberry Pi. In fact Oracle are very keen to promote it as their way into the world of the Internet of Things. If you know Java and want to use it to develop programs on the Pi then it isn't a bad choice. If you want to use the Pi to create Java Embedded programs that can be moved to other "small" machines then this is another good choice.  However if you simply want to create programs that work on the Pi and you don't know Java then Python is much simpler and more direct. 

There is also a C library that essentially brings the Arduino's "wiring" language to the Pi. If you know the Arduino then then you might be tempted to gravitate to Wiring Pi but resist. There is nothing wrong with Wiring Pi, it is a great piece of software but if you want to use Wiring Pi you are making it more difficult to do things that the Pi is capable of and the Arduino finds more difficult. For example, if you want to host a web page with some data then Python makes the is easy and C doesn't. I'm not saying you can't do everything in Wiring Pi but if you want to use it then it probably means that you really should be using an Arduino and not a Pi. 

None of these rules are absolute and there are always good reasons for using a particular approach. 

Two other approaches that are worth knowing about are Scratch and Mathematica. You get both installed by default. Scratch is a very easy to use graphical language that you can teach to complete beginners, including kids, and they can be creating interesting programs almost at once. What isn't as well known is that you can write control programs in Scratch that switch the GPIO lines on and off. It is good for teaching and learning but not really the best way to implement something serious.

At the other end of the scale so to speak is Mathematica. This is a symbolic math language that has lots of sophisticated functions to solve equations, find integrals and so on. It also has machine learning, computer vision libraries and more. You can also use it to control the GPIO. In this case the main reason for using it is that you can implement complex controllers fairly easily. The biggest problem is that the Pi isn't fast enough to do anything really sophisticated in real time so you need to experiment to see if you can make things work. 

At the end of the day the best language to learn for the Pi is Python because it is supported by so many hardware extensions and there are so much existing software.

And of course you can make jokes like Pi-thon.

 

piio

A, B or B+

Ok so you have settled on using a Pi for your project - but which one?

On the face of it the choice seems easy. 

The B+ does everything that the model B does and it has more GPIO pins, it supports the newer HAT expansion cards, it has more USB ports and it uses less power than the B. 

So in a straight choice between the B and B+ always choose the B+ it is simply better for the same cost. 

You might think that the B+ would be the choice over the model A as well because it is nearly as cheap and what you get for the small extra cost is really worth having. However as the A has a number of missing chips it consumes less power. The model B+ uses about 3W of power (600mA) but the model A uses around 1.5W (300mA) and if you hope to use battery, solar or just provide backup power this can make a difference. 

If you do need to make use of a model A then there are some particular problems that arise. It doesn't have a network connection at all and it only has a single USB port. The best solution is to use the USB port to fit a keyboard, use this to configure a low cost USB WiFi adaptor and then reboot and use a PC to work with the Pi in "headless" mode. 

In fact using a PC to work with a Pi in "headless" mode is probably the most productive way to develop projects for a range of different reasons even if you are using a B+ with lots of USB ports. 

Summary

  • The Pi is a complete computer system and as such can act as a server without any additional hardware. 
  • It's low cost and ability to act as a full server means that it can do things that a microcontroller isn't well suited for.
  • A Pi is cheap enough to employ one per task and use networking to gather the results.
  • If you choose a Pi you are going to have to get to grips with Linux.
  • There are a range of different language that you could use to create programs but Python is your best choice unless you have a strong reason otherwise. 
  • If power consumption is not an issue then use a model B+. If  it is use an A if at all possible as it uses half the power. 
  • In most cases working with the Pi via a PC in headless mode is a very powerful way of getting things done. 

 pibp

Real Raspberry Pi

Chapter

  1. Real Raspberry Pi - Why Pi?
  2. Getting Started And Custom NOOBS
  3. OS Images And Custom Images

More Information

Raspberry Pi Foundation

Arduino

Spark

Related Articles

Mathematica 10 Now On Raspberry Pi         

New Raspberry Pi B+

Raspberry Pi Goes Commercial    

Raspberry Pi Gets A $25 Camera

 

 

 

 

Banner
 

To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, FacebookGoogle+ or Linkedin,  or sign up for our weekly newsletter.

 

square

 



 

Comments




or email your comment to: comments@i-programmer.info

 



Last Updated ( Thursday, 22 January 2015 )