5

I already have a RaspberryPi2 - and I've used it in a number of very basic software projects (My background is primarily in software development), but I'm getting more ambitious and find myself wanting to attach different electronics - such as motors, sensors, batteries, etc... which I know very little about.

There are a number of very useful questions on here for applying specific pieces of hardware to the raspberry pi, and while I would have fun following step-by-step implementation tutorials, they generally don't seem to teach me anything - They tell me to connect this to that, use a certain part here, and bang, its done - even though I have learned nothing that would help me in future.

  • What bare minimum knowledge should I know, before working with hardware on the Raspberry Pi?

  • Where can I find resources to learn the bare minimum knowledge?

4

The First and foremost thing that you need to remember is that the Pi works at 3.3 volts, what the hell does that mean? Well it means that most arduino sensors (digital ones, since the PI cannot read analog signals) cannot be interfaced directly as they operate at 5V and will send 5V signals that can damage the Pi.

Also remember that the Pi can only output a very small amount of output current, this means that it cannot run motors directly. You will need a motor driver board.

As for resources on where to learn, grab a book on arduino. Yes I did say arduino, this is because most books for the RPi will have software examples only.

4

Bare minimum knowledge

  • using Ohm's law: (wikipedia: ohm's law)
  • calculating parallel and serial circuits (of resistors): (wikipedia: Series_and_parallel_circuits#Resistors)
  • interpreting datasheets correctly (How much current and voltage is allowed to go through that LED, will this burn my GPIO on my pi?)

(optional, but necessary for motors and pretty much anything that is not an LED.)

  • Basics on motor drivers: (wikipedia: motor_controller)

(Check the "L298" for instance - it's a popular driver that is used in many projects. Also as a short non-scientific explanation: Consider a driver as something like a water-tap. your pi only opens and closes it.)

Thats it.

Consider reading this or something similar.

http://www.instructables.com/id/A-Complete-Guide-To-Basic-Electronics/

3

I hadn't picked up a soldering iron since high school (which was a few decades plus ago) when I got the pi, but like you I have a software background.

Attaching devices that use the I2C or SPI bus isn't that complicated and usually explained step 1, step 2, step 3, because that's really all there is to it. You don't have to understand what the individual lines are for in the same sense that you don't need to understand the wires inside a USB cable to attach and use such devices. In fact, you don't even need to understand that to write USB device drivers -- you do need to learn about the USB protocol, however.

If you are none-the-less interested in understanding them, it is probably much easier if you understand the protocol and make some use of it a bit first anyway. If you don't understand the USB protocol, an explanation of the wires inside the cable is going to be gibberish.

If you want an explanation of the meaning behind how a particular device is attached, feel free to ask about that.

Because of interfaces offered by the kernel and various (pi specific) third party libraries (such as wiringPi, pigpio, etc.), you can write userspace drivers/applications for I2C, SPI, and other devices. As with USB, this requires you understand something about the bus protocol, starting with whatever API you're using.

I found far and away the most complicated part was translating the information in IC manufacturer data sheets into code. Very useful here is if you can find an example/reference implementation in a language you can read.

If you want to do things with individual electrical components (lights, buttons, resistors, etc) via the GPIOs, just jump in, but cautiously since you can damage or destroy the pi by doing the wrong thing. Find a tutorial explaining something simple, work through it, and try to understand the role of each component. Electricity can be confusing, but it is not magic. I was very perplexed by the role of the resistor in a pull-up circuit (which is about as simple as you can get), mostly because of the way the terminology is.

In short:

What bare minimum knowledge should I know, before working with hardware on the Raspberry Pi?

Just being reasonably sane, literate, and having an adult level of patience should be fine.

1

I definitely understand where your confusion comes from.
Getting started can be a bit overwhelming.
While quite a bit vague, I'll do my best to suggest a path for you.

Given your particular situation, I would say it would be most beneficial to you to not dive straight into embedded development with very little general electronics knowledge. Otherwise, you will find yourself in a perpetual loop of "doing without learning" as you identify as one of your difficulties with your searches. This is because learning this way will leave several holes in your understanding of basic concepts, which will lead to lots of frustration down the road. My #1 suggestion is absolutely to start on some kind of general electronics education.

However, if you are seriously bent on jumping straight into the thick of things, I would say that you should first familiarize yourself with a GPIO library (such as wiringPi). The ONLY reason I recommend this to be your first step (other than starting with general electronics) is because you say you come from a software development background. It will give you a taste of hardware, while keeping your focus on software. As you go through the documentation, you'll have to gloss over the more complex topics (PWM, clock speeds, etc.), but then move onto their "blinking LED project" or similar starting point. From here, do some electronics research to understand exactly what is going on before deciding to move on (what the resistor does, what the LED does, why things work the way they do, etc.).

Unfortunately, I really can't point you somewhere specific to learn these things, but a google search for each individual component/element will probably suffice. Just work your way up and you'll thank yourself that you did later.

Good luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.