blog.cyrusroshan.com

02 January 2016

No. 3

A hardware hacker's kit

So you're a beginner to either hackathons or hardware hacking, and you're not sure what to bring? Well, at HackDFW, we've got a pretty solid hardware setup, so you should have everything you need. At hackathons that aren't as focused on hardware though, here's an example list of what to bring. There's also a section on helping you figure out which board to use for a project, and some cool hardware projects to inspire you.

You won't need everything on this list; you'll probably use less than a third of it for a single project, and you'll probably have projects that might need something more than what I've listed. It's always good to be prepared, though, and you can't slap on another sensor in a hardware project as easily as you can download and require another library in a software project.

What you'll want:

Basics:

Here are some things that it'd be hard to really make a hardware project without:

  • Dev Board (an Arduino, Raspberry Pi, Photon, NodeMCU, etc.)
  • Cable (whichever your board needs)
  • Breadboard
  • Jumper wires (optionally include alligator clips)
  • Resistors

Tools:

Some things that'll make working with hardware a lot easier:

  • Needle nose pliers (with built in wire cutters)
  • Screwdrivers
  • Superglue
  • Electric tape
  • Multimeter (this might be too bulky, I don't always bring one)

Input and Output:

You can't do much with just the list of above items. You'll need some of the following, depending on what you're working on, to get a solid project.

Small components:

These are smaller, more basic components, which aren't mounted on a board of their own.

  • LEDs
  • Photoresistors
  • Reflective IR
  • IR Transmitter/Reciever LEDs
  • Transistors
  • Capacitors
  • Piezos
  • Humidity sensor
  • Temperature sensor
  • Hall sensors
  • Vibration Motors
  • Tilt/vibration sensors
  • DC Motors
  • Push button switches
  • Flex sensors (a bit more expensive, I'd only get one)
  • Force sensitive resistors (same as above)

Larger Components:

  • Servos
  • Pulse sensor
  • Ultrasonic range sensors
  • Gyro/Accelerometer (usually have both on the same breakout board)
  • LCD screen (preferably with I2C for less wires)
  • Bluetooth module (you'll need one with BLE support for iPhones)

Additional Power:

For powering your board or components that require more voltage

  • Relay module
  • Breadboard psu
  • 9v Batteries (not for your dev board, for powering a motor that needs more than it can handle. Use with transistor to switch on/off)
  • Rechargeable power bank (for when you want to power your dev board without having it hooked to your laptop)

Where to get them?

So now that you know what to get, where do you get it? If you're looking for reliability, use Amazon, Adafruit, or my favorite of the three (because of their nice guides and docs), Sparkfun. If you're looking to save money (and it does cost a decent amount), check out Aliexpress for components, and your local dollar tree for superglue/electric tape/pliers/etc.

Which board to use?

So, each board is useful for different things. For this, I'm just going to be comparing the three most popular: Arduino UNO, Raspberry Pi 2, and Particle Photon.

There are a few factors that I consider when picking a board:

  • Setup time
  • Usage
  • Language

Setup Time:

  • A Raspi has a decent setup time. You need to be able to set it up to ssh into it, which means you'll need an OS on an SD card, the necessary cables, and a monitor/keyboard/mouse to be able to use it. If you've already set it up before, though, you can just bring it with an ethernet cable (you'll need an ethernet to thunderbolt adapter for macs though). If you're renting one out, though, that's not really an option.
  • An Uno is generally plug and play, so setup time is nil
  • Photons are pretty nice, if you aren't in a saturated wireless airspace. The problem is, a lot of hackathons are. There's a solution to this, though, which is using serial setup. Particle uses the node-serial package though, so if that gets a bit funky (like it did with the El Capitan update on OS X), then you won't be having any fun.

Basically, for setup time, Uno > Photon > Raspi.

Usage:

  • A Raspi can do a lot of stuff, should be able to handle a lot, but it has some trouble with analog input. You can solve that with an analog to digital converter, or by having an arduino as a go-between. I'd use Raspi for anything where you want a small, local server, where you can directly interface with hardware. However, in a hackathon setup, an Uno or Photon can do almost everything, if not more, with the right libraries, so it generally comes down to preference.
  • An Uno can do everything a Photon can do, but it lacks wireless connectivity. However, you can use a node package such as node-serial or johnny-five (the latter also uses node-serial, but check it out as well) to interface with your computer while it's connected over USB, which opens up so many options (and also makes the Uno my go-to board). This does, however, make your setup a bit more complicated, if you're using it for the first time.
  • A Photon can do everything an arduino can do, but with less ports, less libraries, and less guides. It makes up for that, though, with its incredibly easy setup (when it works), and Particle's servers, which you can use as a limited backend. It also has a smaller form factor, if that matters in your application.

Language:

  • A Raspi is basically a full computer, soooo you can do pretty much anything. Most people perfer python on it, though.
  • An Uno can be programmed with C/C++, however, if you use something like pySerial or node-serial, you can write python or javascript programs to communicate with the arduino on your computer, and even just use it as a data-collector if you want (which, out of the three devices, it's the best at). There's also johnny-five, if you want to use literally nothing but javascript (these options require the arduino to be tethered to the computer via USB for them to work).
  • A Photon can be programmed with C/C++, however, you can just send and recieve the data to and from Particle's servers, have all of the benefits of node-serial/pyserial, except just using REST and any server, so it doesn't even need to be local.

Some cool hardware projects!

If you're looking for inspiration, here are a few hardware projects to check out:

  • Sesame, which lets you remotely unlock your door via a smartwatch voice command.
  • A simple tetris game, amazingly small, powered with a LiPo battery, and controlled with push buttons.
  • FifthSense, a tool to for blind people to send and recieve data. Uses buttons for input, vibration motors for output.
Get new indie blog posts in your mailbox, personally written by me