Electronics Engineering / Arduino / Rasperry Pi / Microcontrollers

Table of contents

Child pages


Electronics engineering is awesome; you can make really, really, really cool stuff if you know EE. For a quick idea, look at all the awesome gadgets at these websites:

http://www.thinkgeek.com

http://www.brickhousesecurity.com/

You can prob. also get really rich if you use EE to make a cool invention; most of the people out in the world who know EE aren't very imaginative and will never use EE to its full potential, so if you're good at coming up with ideas for cool stuff that people would buy, it could be a very realistic goal to learn EE and then make a mockup of your idea yourself. Lots of people have done that and gotten their invention in stores or on a TV infomercial. Most people just never try.

I think EE has an association w/ being nerdy, and I think the reason for that is that EE has a steep learning curve; it isn't very fun to learn at the moment. And so I suspect that, in general, the people who are willing to go through the hell necessary to learn it are people for whom the opportunity cost of that investment of time is lower; in other words, the people who aren't going out to hang out at the mall every day.

Forums

How to determine if a microcontroller / microcomputer can help you solve a problem

Arduino:
Fundamentally, what the Arduino allows you to do is to:
1. use sensors that have not typically been available for computers, like vibration sensors, radiation sensors, air-pressure sensors
2. control motors
3. have these components in a small package
4. have this functionality in a cheap / replaceable package, so you don't have to worry as much about losing / breaking it. A key difference between the Arduino and the Raspberry Pi is that the Arduino's "brain" is just a $3 chip that can be popped off for a particular project. You can't do that with a Raspberry Pi (AFAIK).

The key component of the Arduino is the ATMega microcontroller, and just looking up "microcontroller" gives a pretty good idea of when you would want to use it:

  • Microcontrollers are designed for embedded applications, in contrast to the microprocessors used in personal computers or other general purpose applications.

    Microcontrollers are used in automatically controlled products and devices, such as automobile engine control systems, implantable medical devices, remote controls, office machines, appliances, power tools, toys and other embedded systems. By reducing the size and cost compared to a design that uses a separate microprocessor, memory, and input/output devices, microcontrollers make it economical to digitally control even more devices and processes.

 
This is an intimidating thing to try to answer...so I'll try to break it down into simpler steps:

How to determine if a Hammer can help you solve a problem.
- Ok, so you should think about what features a hammer has that separates it from other objects you have available to you. For example, you could use a hammer to open a c

Misc Thoughts:
- One thing about the Arduino is that it makes it EASIER for people to configure integrated circuits. So that would suggest that now we can have less-specialized people creating ICs. What new applications might that allow? Well, it might mean that 1) people could create ICs more quickly in the face of some new situation, 2) we could create ICs for more specialized situations. So that would suggest that if you're looking for places to apply the Arduino, you should look for environments where things are changing rapidly, or things have changed in the past decade or two (so that a large company has not yet tackled some of the problems that have come up), or you should look at problems that are too small-scale to be worth the time for a larger company to solve.

- One thing I'm not sure about is whether I should start with the tool or start with the problem. It's like trying to solve a maze and not being sure if you should start at the beginning of the maze or the end.

Think of problem solving as working your way through a maze
Excerpts from "What is problem solving?" by Martinez, M.E. Phi Delta Kappan, April 1998
http://dsmgt310.faculty.ku.edu/SuppMate ... istics.htm


Quote:
1. Means-ends analysis - Form a subgoal to reduce the discrepancy between your present state and your ultimate goal state. Phrased more colloquially: do something to get a little closer to your goal.
2. Working backward - First, consider your ultimate goal. From there, decide what would constitute a reasonable step just prior to reaching that goal. Then ask yourself, What would be the step just prior to that?
3. Successive approximation - Initial tries at solving a problem may result in a product that is less than satisfying. Writing is a good example. Few accomplished writers attempt to write perfect prose the first time they set pen to paper (or fingertips to keyboard). Rather, the initial goal is a rough draft or an outline or a list of ideas. Over time, a manuscript is gradually molded into form. New ideas are added. Old ones are removed. The organization of the piece is reshaped to make it flow better. Eventually, a polished form emerges that finally approximates the effect that the author intended.
4. External representation - List, describe, diagram, or otherwise render the main features of the problem. This heuristic has several important features. First, it allows us to represent more complexity than we can hold in mind at once. Depicting a problem on paper, whiteboard, or computer screen relieves short-term memory of the burden of representing the problem and allows the processing capacity of our brains to be directed toward solving it. An incidental benefit is that often the very attempt to represent the problem explicitly forces a problem solver to be clear about what it is he or she is trying to do and about what stands in the way. Another benefit of external representation is that the medium chosen to portray a problem may help the solver see the problem in a new way. Finally, an external representation is potentially a public document. The fact that other people can see it might help a group reach consensus about the nature of a problem.
5. Suspending judgment - Understand that, by its very nature, problem solving involves error and uncertainty. Even if success is achieved, it will not be found by following an unerring path. The possibilities of failure and of making less-than-optimal moves are inseparable from problem solving. The willingness to suspend judgment – to accept temporary uncertainty – is an important aspect of thinking in general.


Ask yourself if there are any circumstances under which you would want to shut off the device.
Examples:
1. A portable heater has a tip-over sensor that detects if the heater has been tipped over, so the heater will automatically shut off and avoid starting a fire.
2. I think I remember hearing in a KhanAcademy video that coffeemakers have extra sensors to detect if things have gotten too hot, and they'll automatically shut off the coffeemaker.

Microcontroller stuff

US Raspberry Pi - http://downloads.element14.com/raspberr ... irect=true - This looks like the cheapest way to have a microcontroller with an ethernet port. $25 + shipping
Teensy - http://www.pjrc.com/teensy/ - This looks like it may be the cheapest microcontroller w/ USB port. $16 + shipping

Stepper Motor Control:
Sparkfun $15 Stepper Motor

PC/Web-to-Microcontroller communication:
Breakout - Allows a web browser to talk to a microcontroller using javascript
Seriality - Allows a web browser to talk to a microcontroller; this is Mac OS X only. I think you can use Breakout to do the same thing on Windows.
Arduino and PHP - example 1
RXTX - allows your Arduino to talk to a Java program on your computer [example 1]
Controlling a Stepper Motor via the Web - At first glance this seems to be exactly what I'm trying to do, although he's doing it for a surveillance system

Relays:
Using Relays with Arduino - Turning On the Lights

Learning tools


YouTube:
Channels:
Jeri Ellsworth - http://www.youtube.com/user/jeriellsworth
Make Magazine - http://www.youtube.com/user/makemagazine

Individual Videos:
How Breadboards Work

Electronics Kits:
The reviews for the Elenco Snap Circuits kits have been incredible; I have their smallest kit coming in the mail:
Elenco Snap Circuits 100
Elenco Snap Circuits 300
Elenco Snap Circuits 750

One guy writing a review for the Elenco 500-in-1 kit below rec'd this Kosmos kit:
Kosmos Electronics Workshop 2

The kits below sound like they're an older generation that may still be worth going through; I have the 130-in-1 and have found it useful to get myself used to what the circuit diagrams look like:
Elenco 130-in-1 Kit
Elenco 300-in-1 Kit
Elenco 500-in-1 Kit

Websites:
Electric Circuit Simulator
StackExchange - Electrical Engineering
http://amasci.com/amateur/elehob.html
http://www.allaboutcircuits.com/vol_1/index.html
http://forum.allaboutcircuits.com/showthread.php?t=9538
http://www.electronicsinfoline.com
http://www.kpsec.freeuk.com/proj.htm
http://www.electronics-lab.com/projects/index.html

Books:
There Are No Electrons: Electronics for Earthlings
Getting Started in Electronics
The Art of Electronics
Grob's Basic Electronics (11 is the latest edition)
Make: Electronics
How to Diagnose and Fix Everything Electronic
All New Electronics Self-Teaching Guide - seems good from the reviews

AUDEL BASIC ELECTRONICS
ELECTRONIC CIRCUITS - FUNDAMENTALS & APPLICATIONS by Mike Tooley
ELECTRONICS - CIRCUITS AND SYSTEMS, 3RD EDITION by Owen Bishop
ELECTRONICS DEMYSTIFIED by Stan Gibilisco
ELECTRONICS EXPLAINED by Louis Frenzel
STARTING ELECTRONICS CONSTRUCTION by Keith Brindley
STARTING ELECTRONICS THIRD EDITION by Keith Brindley
TROUBLESHOOTING & REPAIRING CONSUMER ELECTRONICS WITHOUT A SCHEMATIC by Homer Davidson
FASHIONING TECHNOLOGY by 
BUILD YOUR OWN ELECTRONICS WORKSHOP by Tom Petruzellis
ELECTRONICS AN INTRODUCTION by Jim Stewart
PRACTICAL ELECTRONICS FOR INVENTORS by Paul Scherz
PRACTICAL ELECTRONICS HANDBOOK SIXTH EDITION by Ian Sinclair

Electronics Projects Stores:
http://www.machinescience.org/store/home.php
http://www.electronickits.com/index.htm

Electronics Projects Websites:
http://www.instructables.com/tag/type-i ... ectronics/
http://electroschematics.com/



Other Sites of Interest:

http://www.diyvn.net/ - electronics projects by some vietnamese guy
http://www.buildinggadgets.com/ - website of the guy who wrote "Electronics Projects for Dummies"

Electronics Engineering Terms

Transistors:
It's kind of ridiculous how hard it is to find a satisfying explanation of how transistors work.

Video Explanations:
Make Magazine - http://www.youtube.com/watch?v=-td7YT-Pums - worth watching but he covers topics w/ too little detail for it to be totally satisfying. The links he gives at the end were very helpful, though.
http://www.youtube.com/watch?v=F-Cv7CMHoGM - worth watching but not totally satisfying
http://www.youtube.com/watch?v=pni5JRJTMN8 - worth watching but not totally satisfying; what's positive current?
SteelWheelsDown - http://www.youtube.com/watch?v=CkX8SkTgB0g worth watching
- first thing he talks about is how important transistors are to the world, and how ridiculous it is that you can't find a decent explantion online of how they work
- the next thing he talks about is what a diode is: there's a low amount of resistance in one direction but a high amount of resistance in the other direction. This got people wondering if they could get even more different levels of resistance, like being able to get clothing custom tailored vs. only being able to buy small or large.

Written Explanations:
http://amasci.com/amateur/transis.html
http://www.kpsec.freeuk.com/trancirc.htm



Elenco 130-in-1 Experiments in Falstad:
17: Resistors in Series and Parallel
18: Light Dimmer


Stuff I want to make

  • Chess assistant
    • A computer chess assistant that you put in your shoe. You use your toe to enter commands, and it tells you what move to make by vibrating in a particular pattern (morse code?)
  • Larabar dispenser
    • a device that dispenses larabars at a maximum rate to prevent you from eating too many (eg max of 4 per day)
  • a device that detects a certain frequency and lights up when it hears the frequency (so deaf people can hear audio warnings). I looked online and it looks like there are already some out there on the market, but I want to make one 
  • i should make an electronic lock for the front door where you can enable it or disable it, and have custom unlock codes for each person so that if someone gives out their code you know who did it.
  • i should add an electronic doorbell for the house
  • a cheap modern arcade that i can put in coffee shops and barber shops like Warren Buffett did with his pinball machines. I want people to pay with a debit card swipe.
  • I want to make a device like a small tabletop gumball machine that disperses some goodie (like candy) when you play a game on your computer. I want it to lock so that there's no way to get the treat out w/o playing the game. In an emergency if the person needs to get it out they should have to go to my website and pay me for a code that will open it.
  • A car safety device that electrocutes people like in that Robocop commercial, or other stuff that electrocutes people(?)
  • Dance Lighting
    • A device that controls a whole bunch of different lights and times them to music so that the intensity/color of each light corresponds to a particular instrument in the song.
  • a camera that takes pictures automatically when people are hanging out in front of a street mural
  • a smoke alarm that automatically sends a text message to a landlord if the alarm has been going off for more than 5 minutes. Or a doorlock that sends a text message to a landlord if it has been unlocked for more than X amount of time.
  • hilarious prank that Steve Wozniak pulled in college:
    • Built a TV jammer...the only color TV (1968) was in the basement of Libby Hall, a girl's dorm. I sat there one night and jammed (fuzzed up) the TV. A friend hit the TV and I made it go good. After a few sessions, they started stationing a student right by the TV every night whose job it was to knock and pound and adjust (fine tuning in those days) the TV until it worked. I started making it work depending on what they did and where their bodies were. I got a guy to stand on a chair with the twin-lead antenna in his hand to make it work. One time I got a guy to hold his hand on the TV screen and a foot on a table while he stood on the other foot, to watch the last half of Mission Impossible.

      I built one of these TV jammers into a magic marker. I was taking introduction to computers, which was a graduate course back then. I did get an A+ in the course but ran our class 5x over budget due to all the programs I ran on the CDC 6400 supercomputer. Well, this class was in 2 classrooms. The upperclassmen watched the professor live and the rest of us were in a room with 4 TV's. My jammer worked but the TV near me barely got jammed and others to varying degrees. 3 guys stood up in the front of the class looking back. I was going to turn my jammer right off but I didn't know TA's were present. They said to turn off the transmitter but I wasn't about to own up to it. If I reached down to turn it off, the guy next to me would see me and I might get caught. It was a dilemma. I left it on. Near the end of class, a guy under the TV jammed the worst gathered his books to leave class early. As he walked toward the door in the front right (from my view) I made the TV's go in-and-out, in-and-out. When the guy left through the doorway I made the TV's go good. A TA pointed at the student who had left and said "there he goes."

  • area-denial devices. Basically, if I want to use the living room, or I want a table at Starbucks, or a bench at the park, I can hide an electronic device near the desired place and it will somehow get the people there to leave. Maybe w/ an annoying sound, or by releasing some kind of smell, or something else I haven't thought of.

Arduino

Cool projects

Teensy

IIRC I first learned about Teensy when I discovered (through an experiment) that the Arduino couldn't operate quickly enough to control lights in-sync with fast-paced music, and so I went looking for something faster, and Teensy seemed to be exactly what I was looking for.


Raspberry Pi

How to do various things

Linux Commands

From a Windows machine, getting a list of open ports from a website or IP address

Quote:
nmap -A -T4 -F http://www.microsoft.com

- useful if you're setting up a RPi on a network

List all running processes

Quote:
ps aux | less

More info: http://www.cyberciti.biz/faq/show-all-r ... -in-linux/


List all open/active ports

Quote:
sudo netstat -pln

More info: http://serverfault.com/questions/357323 ... -on-debian

  • How to Connect to the RPi without a Monitor by using SSH
    • These steps are best for when you're using the RPi at home. IIRC I got this info from pingbin (see the links below)
      1. Use an ethernet cable to plug your RPi into your router
      2. Log into your router to see what the RPi's IP address is
      3. Use Putty to connect to that IP address
      4. It should ask you to log in once you connect, the default username is "pi" and the default password is "raspberry"




How to find the RPi's IP address on a network if you don't have a monitor and don't have access to the router
http://www.raspberrypi.org/documentatio ... address.md

1. Install nmap (Google it)
2. Open the command prompt
3. Run "ipconfig" to see what your IP address is, it's listed in the field labeled "IPv4"
4. Then run nmap using the info from your own IP address. For example, if your IP address is 192.168.1.15, run "nmap -sn 192.168.0/24"
5. Look for something that says "Raspberry Pi Foundation". That's the one you want. If you don't see it, wait a few mins and run nmap again.


Quote:
On Windows, go to the Control Panel, then under Network and Sharing Center, click View network connections, select your active network connection and click View status of this connection to view the IP address Now you have the IP address of your computer, you will scan the whole subnet for other devices. For example, if your IP address is 192.168.1.5, other devices will be at addresses like 192.168.1.2, 192.168.1.3, 192.168.1.4, etc. The notation of this subnet range is 192.168.1.0/24 (this covers 192.168.1.0 to 192.168.1.255).

Now use the nmap command with the -sn flag (ping scan) on the whole subnet range. This may take a few seconds:

nmap -sn 192.168.1.0/24 Ping scan just pings all the IP addresses to see if they respond.


Troubleshooting: RPi works via SSH but I can't access the webcam via its IP address
http://fqvn.com/tags/index/android/web-server


Light up LED using GPIO



This guy's webcam tut was awesome so I'm guessing this tut is great too. Lighting up an LED is like the "Hello World" of microcontrollers.
http://pingbin.com/2013/01/to-control-l ... y-pi-gpio/



Set up the RPi to use WiFi



Another excellent tutorial from this guy:
http://pingbin.com/2012/12/setup-wifi-raspberry-pi/

These are the settings that ended up working for me, I got them from one of the comments:

 

Quote:
—– /etc/network/interfaces —–
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
—– /etc/wpa_supplicant/wpa_supplicant.conf —–
network={
ssid=”put the name of your wifi network here″
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk=”put your wifi password here″
}



Setting up a Webcam Server



I followed this excellent tutorial and bought the powered USB hub it recommended (I didn't buy the webcam b/c I already had an extra one):
http://pingbin.com/2012/12/raspberry-pi ... er-motion/

I used a Logitech C210 and ran into a problem after following all the steps in the tutorial above: I was getting an error saying that there wasn't anything in /dev/video0:

 

Quote:
Failed to open video device /dev/video0: No such file or directory

I spent about 30-40 minutes Googling and finally I tried a bunch of things that made it start to work. I'm still not totally sure what was the essential stuff and what wasn't. The final step I took was to reboot the RPi, so that may have been all it needed from the beginning. But below are all the steps I took:

1. I read the link below, where someone said they were able to fix the problem by creating the video0 folder and allowing read/write access with the commands below:
http://www.linuxquestions.org/questions ... o0-261133/
mknod /dev/video0 c 81 0
chmod 666 /dev/video0

2. The problem was that I couldn't do that because I kept getting "permission denied" errors. So I had to first create a super user (admin) password by typing some other command I can't remember. Once I set a password and logged in with "su -" I was able to run the two commands above.

3. And once I did that I restarted the RPi and it started working.


Fixing problems while trying to get the webcam running at work

WiFi Issues ? Start here !
http://www.raspberrypi.org/forums/viewt ... 28&t=44044

Cannot connect to Pi via web browser
http://www.raspberrypi.org/forums/viewt ... 5&p=516685

no access to motion server
http://www.raspberrypi.org/forums/viewt ... 1&start=25

motion works, but does not show stream
http://www.lavrsen.dk/foswiki/bin/view/ ... x01x104741

Summary: I didn't realize that the IP address of the LAN connection was different from the IP address of the WiFi connection. So I first had to figure out how to get the IP address for the WiFi connection. After that I forgot that Chrome doesn't support direct JMPEG feeds anymore; you HAVE to use Firefox to see the feed. And then I didn't realize that you can't have the feed on port 80 without setting special permissions, because port 80 is restricted to programs running as user "root". So I had to switch it back to running on 8081. And then I had to restart the RPi before it started to work. So basically it was a huge pain.

Note: The WiFi connection may show up as "Edimax" if you are using an Edimax WiFi dongle when you run "nmap -sn 10.1.11.0/24". With an ethernet connection it shows up as "Raspberry Pi Foundation".

If you are connected to your RPi via ethernet and also have the WiFi connected, you can check what port the WiFi is operating on by typing "ifconfig" into the RPi's terminal.

Printing from RPi (useful for kiosks)


This tut looks like it might be good:
http://www.howtogeek.com/169679/how-to- ... -computer/

Making a Kiosk

Pi Kiosk: An open source web kiosk
http://pikiosk.tumblr.com/

pcDuino Crowdsource Kiosk (this is not for RPi but it's related enough to be useful)
https://learn.sparkfun.com/tutorials/pc ... urce-kiosk

Cool projects

HackADay

http://hackaday.com/
I've checked out their archives from 9/1/2014 to Jan/21/2014


2014.04.20 - HackADay - Pan Flute Hero
http://hackaday.com/2014/01/30/pan-flute-hero/
- This is related to my interest in gamifying exercise equipment by attaching sensors to it

2014.04.20 - HackADay - S.A.M. The Safety Attention Monitor
http://hackaday.com/2014/01/30/s-a-m-th ... n-monitor/
- related to my interest in recording people in the job booth I want to make

2014.04.20 - HackADay - The Raspberry Eye Sees All
http://hackaday.com/2014/04/20/the-rasp ... -sees-all/

2014.05.09 - HackADay - Raspberry Pi Boiler Control Uses a Webcam to Read The Analog Gauge
http://hackaday.com/2014/05/09/raspberr ... log-gauge/

2014.06.15 - HackADay - PiGates Validates Your Concert Tickets
http://hackaday.com/2014/06/15/pigates- ... t-tickets/

2014.07.10 - HackADay - Pi-Powered Anti-Cat Trap Soaks Felines and Other Animals
http://hackaday.com/2014/07/10/pi-power ... r-animals/



2012.12.03 - PingBin - 40+ Cool Ideas for your Raspberry PI Project
http://pingbin.com/2012/12/30-cool-idea ... i-project/