Skip navigation

Arduino

5 Posts authored by: Dave Young

Penny.JPGDoorbells are the 20th century version of today's perpetually-interrupting cell phone. There you are, cooking a delicious dinner or reading a nice book when the doorbell rudely goes off in your ear. Sure, you're glad to see whoever is at the door, but interruptions that chime can be so obnoxious. Needless to say, I do not have a doorbell.

 

The problem with the knocking system is that I usually can't hear when someone knocks from my lab. I depend on Penny the Dog to alert me when someone is at the door. Except Penny sleeps most of the day. And then there are the delivery people (UPS/FEDEX) who can't be bothered to knock, even if it is a next-day-early-AM shipment of parts from element14 that I am eagerly waiting for.

 

I decided that I'd create a project that solves all of my problems: a silent LED that flashes whenever someone approaches my door. It is based on a laser tripwire and will be able to run day or night, even in the bright Denver sun. And if the blinking LED is annoying, a simple button press disables the alert and resets the trigger.

 

 

Tripwire Design:

The laser tripwire is set up to be as simple as possible. A laser is reflected off of a mirror and back to a photoresistor which is one leg of a voltage divider. The complete schematic is attached below. The varying light intensity changes the output of the voltage divider, which can be read by an A/D. To make the 'target' for the laser easier to hit, a Fresnel lens is used in front of the light sensor like one would see with a PIR sensor.

 

Transmitter.jpgWireless Link Design:

With the sensor defined, the rest of the wireless link must be considered. The XBee series 1XBee series 1 by Digi is a great solution to this problem, and there is a wonderful starter kitwonderful starter kit to get going. It is a wireless communication system that has an integrated A/D that can transmit the detected light level digitally. It is also a commonly used device and is one of the easiest ways to create a wireless link. Unfortunately, in order to use the standard XBee interface, the digital value is only presented on the receiving end by a PWM signal. This PWM signal is filtered which produces a DC amplitude level that can be read by an Arduino's A/D. While having to do an A/D conversion at the transmitter and again at the receiver is not ideal, it was a sacrifice made to prevent a custom implementation on the XBee.

To setup the XBee radios, I used their bloated-yet-functional (113MB) XCTU XBee setup utility and the XBee USB Adapter board that was included in the starter kit. Note that you may need to install some FTDI Virtual Com Port (VCP) drivers.

I followed two of Digi's examples in order to get the settings correct:

http://examples.digi.com/sensors/sensing-light-levels-with-a-photocell/

http://examples.digi.com/lights-motors-more/wireless-panel-meter/

The transmitter settings that I used were:

ATRE N/A

ATID 3001

ATMY 1

ATDH 0

ATDL 2

ATDo 2

ATIR 64

The receiver settings that I used were:

ATRE N/A

ATID 3001

ATMY 2

ATPo 2

ATIA 1

ATWR N/A

 

Receiver.jpgArduino Design:

Shields are possibly the biggest time saver that exists in the Arduino ecosystem. The XBee board is on 2mm pitch headers, and having some extra perf board to put the low pass filter and button on is super helpful. Arduino's wireless shieldArduino's wireless shield worked great for both challenges.

The filtered output from the receiving XBee is fed into an Arduino LeonardoArduino Leonardo for processing. The code is attached below, but the basic pseudo-code operation is:

Save the last sensor value

Read a new sensor value

If the new sensor value is greater than the past value by at least a threshold, detect a trip

Blink the LED and wait for a timer to expire or a button press

Loop back to the start

In order to make the tripwire system work at any light level, a simple comparator action wouldn't work. The threshold at night would need to be different from a daytime threshold. It would be possible to take an ambient light reading with a separate sensor and base the threshold on that, but a more elegant solution for this application would be to pay attention to the rate of light change. If the light changes by X amount within a very short period of time, a trip is registered. However if the light changes over a few seconds or minutes, it will not register a trip. Testing has shown this to work in pitch black as well as on a sunny day (although in the shade).

 

Mechanical Design:

With the electronics designed and code written, I had to put the transmitter in a project box to shield it from the elements. I found a simple enclosure, although I needed to remove the included metal plate. According to Digi's layout suggestions on page 9 of their manual, there are limitations on where metal can surround the area near the antenna. A hole for the lens, the laser, and the power supply were the only mechanical modifications required.

 

Problems that I encountered:

No project goes exactly to plan, so here are a few snags that I hope you'll be able to avoid:

  • The XBee software was more obnoxious than I expected for an entry level wireless protocol setup.
  • The power supply that I bought was so crappy and noisy that is was causing bad data to be sent. I had to add a 470uF electrolytic cap at the power input. A higher quality supply should be used.
  • I tried a getting started guide from parallax to try and verify that the hardware at least worked, but I found that the Arduino sketch didn't compile. I could have been missing something silly, but I don't have much patience for getting started guides that require dissection. So I decided to go to the source and follow Digi's getting started guide which isn't too far from what I needed for this project anyway. That worked great.
  • When uploading new firmware to the Arduino, the switch on the wireless XBee shield MUST be in 'USB' mode for it to work. Otherwise you'll get the following error: avrdude: stk500_getsync(): not in sync: resp=0x00
  • The unit only works in the shade, since direct sunlight washes out whatever the laser can produce.

 

And that's it! I now have a silent method of knowing when someone approaches my door. The next step will be to connect it to the cloud so I can set alerts to my phone when I'm away. Stay tuned!

 

Documentation Attached In .Zip File:

Laser Doorbell.sch: Schematic in EAGLE format

Laser Doorbell Schematic.pdf: Schematic in .pdf

Laser Doorbell BOM.xks: Bill of Materials

DY_Doorbell_Code.ino:  Source code for use with Arduino IDE

Diavolino.jpgArduino has a pretty good footing as the household name for beginners to get into electronics.  Especially when it comes to that critical first task of blinking an LED, no other manufacturer makes it easier.  Thanks to the power of today's microcontrollers, there is enough functionality in an Arduino to take a beginner and turn him or her into a pretty dangerous designer.

 

But what happens when the newly-accomplished engineer wants to expand beyond the hardware provided by the Arduino?  Most people buy a shield which is a board designed to interface to the I/O pins of the Arduino, and some even design their own shields.  However thanks to the Open Hardware nature of the design, there is a lesser-used method for customization: creating a 'derivative' AKA 'clone'.

 

A derivative/clone is a copy of the board with some design change(s) that still takes advantage of Arduinos development environment.  The Arduino EAGLE design files can be found on the product page on the Arduino site and it is 100% allowed by the Open Hardware License to download them for any use, including commercial products.  Many people have already designed and released their own version of Arduino by making a smaller or more capable board.  These new products add extra functionality while still enjoying the benefits of Arduino's widespread adoption, ease of use, and vibrant community. And since the stock designs weren't optimized for small size, most have plenty of room for additional parts, especially something simple like a switching boost converter, high-power FET, or a high power RGB LED circuit.

 

Derivatives enjoy some significant design benefits over a shield.  First, a single board is less than half the size and more robust than stacking an additional PCB on top of the purchased Arduino via headers.  Second, it will be a cheaper solution than buying a stock Arduino and the custom shield PCB/parts.  Finally, there is a lot to learn from starting with an existing PCB design and tweaking it.  Not to mention the pride one would get from creating their own stand-alone design, even if it is attained by standing on the shoulders of giants.

 

Of course there are some drawbacks relative to designing a shield, starting with the extra hassle of purchasing and soldering the standard Arduino components on the custom PCB.  The layout may also be harder because of the limited space and having to move some of the stock components around.  And if the designer wants to share the functionality with others it is much easier to pop a shield on a stock board than having to build up a custom unit.

 

With all of the benefits, many budding engineers would be well served by chasing a derivative. Who knows?  It could scratch a widely-felt itch and end up turning into a real product!

Arduino Library.jpg

Have you put together an Arduino-based circuit and looking to nicely (but easily) document it?  Or perhaps you're looking to create an Arduino Shield with EAGLE and want to start with the correct dimensions of the headers.  Element14 has come to the rescue with the Arduino library of EAGLE parts for exactly that.  There are two types of components in this library: the standard version with a PCB footprint showing the key connections and the 'EXT version which has no PCB footprint.

 

The Standard version will be great for those looking to create a shield or want to somehow integrate the Arduino somewhere on another PCB.  While the EXT version allows people to create a schematic that doesn't bother with a PCB.  In the EXT case, the user can create a PCB that is intended to connect to an Arduino via cables that are shown on the schematic, but isn't included on the PCB. 

 

Faster documentation, easier creations!

ContextualElectronicsFront.png

Chris Gammell is an accomplished Electrical Engineer who currently works in electronics design by day and talks his head off about electronics by night to anyone that'll listen.  He co-hosts The Amp Hour podcast, writes on ChrisGammell.com, tweets more than most engineers, and is on the cusp of launching a new way to learn electronics: Contextual Electronics.  I've known him from our time at Case Western Reserve University and two different jobs, and was able to catch up with him for an hour to discuss the direction he is taking, his experience, and a few lessons he's learned along the way.

 

The abridged version is written below but those who want to hear the full source can grab it at the end of the article.  Enjoy!

 

Dave: Hi Chris.  To get started, how do you introduce yourself at places like OHS or Makerfaires?

Chris: I'd probably say that I design electronics.  Or at least I'd start with that.  I don't want to lead with 'Oh, I design electronics! And I do a podcast! And all this other stuff!'.  I usually start specific and see where the conversation goes.

 

Dave: That makes sense.  Then how would you describe what you do with your life, both for work and for hobbies?

Chris: I currently design industrial electronics, but before that I worked for Keithley in precision analog, and my career started with a co-op in audio tech.  I also manufactured Silicon at Samsung in Austin.  Outside of work, I have the Amp Hour (a podcast about electronics) and I'm currently planning the launch of Contextual Electronics (CE) which is a video education course.

 

Dave: Given all of the content that you just described, there must be a goal you are pursuing.  What would you say drives you to get up on a Saturday morning and put together videos, podcasts, and articles for people you don't even know?

Chris: Well, who says I'm making it for them? [kidding!]  I got into blogging for all of the wrong reasons.  In 2007 after reading the 4-hour workweek I thought I was going to make money from it.  Boy was I [not] right!  I don't know if I've ever made money from writing.  When I was getting ready to change jobs and move from Austin to Cleveland while the financial crisis started I got nervous and blogging was a nice crutch to lean on.  Plus, I've always enjoyed writing which kind of transitioned to podcasting, and now video education.  I like interacting with people and talking with them and getting emails from them.

 

Dave: So you got into content production for the interaction then?

Chris: Yeah, I think so.  There have been some benefits for my career as well.  I can point at projects and writing pieces that I've written.  Take Jeremy Blum as an example as a prolific blogger and show-off [Kidding!] who does a great job posting his content online and sets a great example.  The same goes for Dave Jones, Jeri Ellsworth, Alan Yates, etc.. all posting content which encourags me to do more and put ideas out there.

 

Dave: With work, TAH, CE, dogs, wife, house, do you spend time doing anything else? Have you been getting your exercise?

Chris: Oh no!  The background there is that Dave would run an exercise pool to help keep people exercising ($5 cost for a missed workout goes to charity).  But the answer to that is no, I haven't been exercising so I guess I owe you [Kidding!].  But I have no other time.  Not even time to work on the house.  My wife is wonderful and really helps out!

 

Dave: Would you call your life a good one then?  Would you like to improve anything?

Chris: Of course I've got a good life.  I'm very blessed. I've got a good job, a great family and friends.  Definitely a good life.  What I'd like to improve is balance.  But then again I get antsy if I have downtime.  There's always a list running in my head. I'm not sure how to draw that line between working and not – but is it really work if I enjoy it?  If you don't have a boss who’s yelling at you to be there – is it really work?

 

Dave: Fair point, I know many struggle with that same thing. So what is your career background?  Where did you start, and when did you decide you wanted to be in electronics?  You could have been like several of our classmates and hit the eject button upon graduation.

Chris: I don't know.  To be fair, I did hit the eject button. My first co-op was electronics, but my second was digital signals which was mostly math.  Then I went on to process control in silicon manufacturing.  Those two weren't electronics.  But then I got sucked back in by you [Dave] inviting me to interview at Keithley!  That switch was precipitated by the tough life in Silicon manufacturing; 60 hour weeks, being 'on-call', it's similar to being an ER doctor.  Your job is to nurse things thorough.  Beyond that, there are only ~200 fabs in the world that would hire you.  So I could either keep doing what I was doing and go into management, or get into something else.  So electronics it was!

 

Dave: Tell me about your first exploration in connecting with many other people on the net.  What did you like about it?

Chris: I liked fleshing my ideas out and having a well-thought out argument.  Often times with impromptu discussions I'll shut down conversationally, but having a topic that interests me already thought out was fun.  Also the ego boost is nice.

 

Dave: What was different about the way things were when you started vs. the way things are now?

Chris: Well, video was very fledgling back then which is crazy to think about now.  8 years ago YouTube started fresh.  It's strange to think of a world without youtube so that's a big change.  Twitter started in 2007, which I like as a connection medium.  Both of those are huge differences.

 

Dave: Why shift from producing content for the casual consumer like podcasts to creating your own independent online courseware in CE?

Chris: Thinking back to when I started learning electronics after my fabrication job and even all the way back to college and co-ops, I found it to be a confusing field.  It's scary because it's expensive in some ways, even if costs are falling.  But I want to help alleviate the fears in others that I had struggled with.  The other thing would be that I'm trying to make content creation a bigger part of my life.  And CE is something that I would be able to charge for and give it the attention it needs.  After thinking about it over and over, I decided that I just have to try it.  If it doesn't fly then at least I tried.

 

Dave: Given that you charge for CE, people must ask, 'what will CE do for me?' How do you respond?

Chris: It'll get you more confident in designing and building electronics because you'll be doing it with me and other students. Also, it's one course – beginning to end.  There are lots of great tutorials online which I really like such as kit building and module integration.  But if someone wanted to design something like a custom temperature measurement system or light sensor and want it to be more formal than a breadboard the instruction doesn't exist.  I think that it's a question of resources.  Most of the resources and tutorials are with kit makers.  Their incentive is to build kits that you want to buy.  There's not really an incentive for them to show everyone how to make kits.  CE would be the lesson on how to do layouts and make the kit for yourself.

 

Dave: With that void you hope to fill with the new CE program, who would be your 'ideal student?'

Chris: My ideal student is an advanced Arduino user who is likely a software or network admin person.  Someone who has integrated a couple shields and has a huge sandwich of things that does what they want it to, but they need to integrate it into one product.  Of course others are good fits to, but that's my target.

 

Dave: What would you hope the 'ideal student' moves on to once they complete CE?

Chris: With CE we are going to build a project together.  I want it to be their first entry into their online portfolio so they can show what they've built.  I want them to immediately go build another project after the course.  I was talking to someone over email earlier after Laen was on the Amp Hour.  He went out and taught himself how to design a PCB with KiCAD (which we are using with CE) and he was amazed by having the thing that he designed and built.  That's a big deal.  I was telling him about the first time I built a board, which was a stupid breakout board.  I remember when I got it in my hands, I couldn't stop turning it over and over. I couldn’t put it down.

 

Dave: Our president of the USA would be upset at me if I didn't ask how far away a CE graduate would be from a job in industry.

Chris: Well, that depends on the job.  I know a lot of companies require a degree, but I'd like to move away from that.  If an applicant came in with a portfolio of what they have built, and they can explain their design and experience I don't care about their degree.  I'd say a student finishing CE is about 5-10 more projects away from a job.  I've never wanted to hire someone so badly as when a student at a career fair came to my booth and pulled PCBs out of his pocket to talk about.  People like that don't stay available for long.

 

Dave: So how do you teach this stuff?  Do you grade classwork, or is it totally on the user to learn?

Chris: Well, I can't have it where people just watch me build something.  I came up with 3 steps for the student to go through. The first part is the background about what we're doing.  For instance in picking a relay we would talk about what they are and why we pick the ones we do.  The second step is to give the students a task.  Give the students a chance to struggle and complete their own solution.  The third stage is to show them how I did it.  Not that it's right or wrong, just how a professional approaches the problem. The student can then compare what they did to what I did.  We also have students divided into different groups.  The goal is to create social connections amongst them.  Students can use a general forum, but they may get 100 responses, all different and possible conflicting.  With CE, you'll be able to connect with your small group to develop a rapport on CE's forum.  This allows things that forums don't encourage like asking a question for a second time, which can be a beneficial experience for both the asker and answerer. It turns the question into a discussion.  Hopefully this will get people more involved and more motivated to get their project done.

 

Dave: Will you offer certificates of any sort?  Do you hope people will be recognized for going above and beyond?  How would you gain such recognition?

Chris: No, since the certification is your project.  What else matters?  Does a piece of paper from me matter?  I could print one and send it to you.  But the pursuit of a piece of paper doesn't matter and encourages people to game the system.  The project doesn't even matter.  What ultimately matters is what the project represents; that you can finish something and design something.  Really only the certifications are showing that you can get through a program, it doesn't address exactly what the employer is looking for in an employee.

 

Dave: So then what is the deliverable for the students?

Chris: An Arduino shield.  I would have my students describe it as a device that completes all of the essential tasks that you might need on your bench.  It measures temperature and analog signals, outputs light, protects and modifies power, has a relay, and it can drive current and voltage.  I've been calling it a BenchBudEE! I'll talk more about the specifics as we get closer to launch.

 

Dave: You've got the initial deliverable for the course as a custom arduino shield which each student completes themselves, including PCB creation with KiCAD.  Once this course meets with success, where do you take the program?  What grandiose plans do you have moving forward?

Chris: I want to make another course!  I've talked about doing a raspberry pi based project, or maybe a beagle bone.  The project doesn't really matter I just want it to be useful.  I guess I'm calling it 'Engineering Voyeurism'  as a way to show how to troubleshoot something.  There's a lot of value in watching how someone works.  There are many different fields I could dive into; it's just a matter of showing how to do stuff.  I can guarantee that the first course won't be perfect, and that will likely drive me to improve it and add what is missing.

 

Dave: I noticed that your pricing structure includes some specialized attention for premium users.  What sorts of discussions are you expecting to have with them?  What would be the venue? Will they be available for the rest of the class?

Chris: It'll likely be over google hangout.  It'll get specialized attention on the forums, 1 on 1 sessions and group sessions.  Because it's tough – and I'd like to be sure I'm giving the right support for different people.  The content will remain with that individual student so it won't go into the rest of the course. But we will have group sessions for everyone that will allow questions and will become public.

 

Dave: If someone wanted to give it a shot before signing up, is there a trial or set of sample classes that they could look at?

Chris: Yeah, there's a small project I did (that a few other people have done that I didn't realize) called 'getting to blinky' since the dev boards equivalent to 'hello world' is getting an LED to blink, which is a magical thing.  And I wanted the same thing with developing hardware.  So I made 7 or 8 videos with all the different KiCAD steps resulting in a board the you can order from OSHpark. Students can follow what I did or do it themselves.  Get the board back, build it up, and get your blinky on!

 

Dave: What would you suggest to an upcoming college grad this May 2014?

Chris: Don't wait until May to start talking to someone about work.  If you want to work at SpaceX or Tesla, go after it!  Find a way to talk to people that work there.  And if it's not too late to do a co-op, do one!  If it is too late, build up your project portfolio outside of class.  Do what you can do have a solid set of things you can point at that displays your skills.  And don't be afraid to put hobbies on your resume.

 

Dave: Thanks a ton Chris!  I can't wait for CE's launch next month and seeing what your students produce!

 

Key Specs:

There has been a lot of anticipation for the arrival of the Due, and with good reason.  The board's capabilities far exceed other Arduino boards and does a good job rounding out the product line.  Here are some key specs that Arduino proudly publishes on the product's page:

  • $49 price point
  • 32-bit processor at up to 84MHz
  • 54 Digital I/O pins, 12 ADC pins, and 2 ADC pins
  • 2 USB-micro ports: one for programming the Due, the other for interfacing with peripherals

 

What makes the new board so great?

The Arduino Due, like all Arduino boards, are designed to give users access to the power of Atmel microcontrollers in the easiest fashion possible.  In the Due's case, it leverages the additional power and capabilities of the Atmel SAM3X8E chip to produce its impressive specs.

 

Most people are interested in how the Due compares with the ubiquitous Uno, running on the well-known Atmega328 chip. Because both boards primarily enable users access to the chips' features, the main differences between the Due and Uno are defined by their respective chip datasheets.  To get right to it, here is why someone would spring for a Due above an Uno:

 

ParameterUnoMegaDue
Digital I/O:145454
I/O that can PWM:61512
Operating Voltage5V5V3.3V
Analog Inputs (ADC):6x 10-bit16x 10-bit12x 12-bit
Analog Outputs (DAC)<none><none>2x 12-bit 1MSPS
Processor:Atmega 328ATmega2560 SAM3X8E
Processor Architecture:8-bit RISC at16MHz8-bit RISC at 16MHz32-bit ARM at 84MHz
Flash Memory (for firmware)32kB256kB512kB
RAM:2kB8kB96kB
DMA:<none><none>Yes, for up to 17 peripherals
USB Host<none><none>USB OTG
Timers2x 8-bit, 1x 16-bit2x 8-bit, 4x 16-bit9x 32-bit
Power in lowest state (uC chip only)0.1uA0.1uA2.5uA
Ethernet MAC (EMAC)<none><none>1 at 10/100
Price$24.52$47.22$49.99

 

Clearly, an experienced user gets some serious bang for the buck with the Due.  Although I don't see this causing many problems for Uno or Mega sales.  As capability is added complexity follows; beginners won't have much use for a USB host when starting from square one.  But once they are ready to move on, a $50 upgrade will be waiting at the next level with a Due.

Filter Blog

By date: By tag: