2. CodeStock is proudly partnered with:
Send instant feedback on this session via Twitter:
Send a direct message with the room number to @CodeStock
d codestock 413c This session is great!
For more information on sending feedback using Twitter while at
CodeStock, please see the “CodeStock README” in your CodeStock guide.
RecruitWise and Staff with Excellence - www.recruitwise.jobs
38. Getting Started with
Arduino
Jim Christopher
Code Owls LLC
jim@codeowls.com
http://twitter.com/beefarino
http://www.beefycode.com
Notas del editor
Thanks for coming to this session, this is Leveraging Azure Cloud Services from Fluent Cobol.NET
SETUP:
PING on pin 7
Launch missle command
Personal sponsor: Oreilly, the animal books, have provided a few giveaway items for you guys today.
Me
The theme here is community and networking…
Charduinophiles
Getting organized
robot competitions
General nogoodnicking
Any interest, let me know
I’m assuming this is untread territory for you. Embedded systems in general, Arduino specifically. Is that accurate?
How many of you have heard of Arduino? Use it?
Any embedded systems developers?
So what’s the big idea behind physical computing?
Anyone seen or have one of these (missle launcher)?
Lots of people have one, even Ted in accounting.
It comes with this control panel that lets you aim and fire. Boring. And Dangerous.
In the world of cube warfare, we don’t want to be tethered to our keyboard and mouse, we need our PC to react to stimulus on its own.
So we add a sensor … I need a volunteer, someone to take one for the group
We make physical changes to our environment all the time based on external stimuli that our brains can process.
When the sun comes up, we flip the light switch to off…
When the sun goes down, we flip the switch to on.
The idea behind physical computing is to change the way we’re interacting with our environment. Instead of a switch we have to choose to flip, let’s use a photo sensor to detect light.
Then it can manipulate the lightbulb based on the light available in the room.
Then let’s add an infrared sensor, so when our body heat leaves the room...
The light won’t stay on.
That’s the big idea: to change the way people interact with their environment using sensors and small computers.
Arduino means two things: it’s a hardware platform and an IDE.
The IDE is used to program the hardware to read and manipulate electrical signals.
What makes Arduino cool is its simplicity.
The hardware is designed to make hooking up and reading simple electrical sensors very simple. There is no extra fluff between your project and the sensor (e.g., device drivers), the connections you need to make are placed conveniently on the hardware board.
Using those same pins, it’s also easy to invoke transducers, like lights and speakers.
There is very little coding and hardware manipulation involved to get things working in comparison to what it takes if you were using Windows or a “raw” embedded system.
This is the board…
The arduino hardware and language are targeted to designers and artists, not EE’s or software geeks.
The goal of the project was to eliminate the need for a scruffy engineer as part of the prototyping process.
Arduino makes hardware FUN.
Any device driver developers out there? Ever had to write a driver for hardware that was closed?
The platform and IDE are both open; you’re probably familiar with open source software. The hardware platform is open too…
This is the electrical schematic for board – there is no statement of ownership on here, no copyright. You can download this and build one yourself if you know what you’re doing, and you owe no one a dime.
This has led to a proliferation of various Arduino-compatible boards, each designed to fit a particular niche.
Of particular interest is this one that looks like a flower –
Betsy, you here? What’s this one for?
it’s designed to be sewn into clothing.
HOW MANY OF YOU ARE .NET DEVELOPERS? Heard of .NET micro?
Quick comparison of the Arduino platform to the .NET micro, which may be the closest point of reference for most of you.
Arduino uses the ATMEGA 328 processor, it’s 8bit
A typical .NET micro device will use something akin to the USBizi144, 32 bit.
This chart shows that the USBizi can perform more operations per second, comes with 16 times the programmable Flash space, and 48 times the RAM. It’s a far beefier processor.
But with great power comes great power consumption…
First, note the cost difference.
The big issue is power use – the Arduino ATMEGA uses 500 times less power under normal operation conditions, and 266 times less power in low-power mode.
The point of all of this is that Arduino and .NET micro target different projects
Arduino is aimed at simple GPIO and signaling, .NET micro is aimed at “little pc” devices.
Let’s take a few minutes to look at the hardware involved…
First project is a simple one ->
We have the arduino and our breadboard, some wires connecting everything up ->
On the breadboard we have a single LED, a button, and a resistor.
We’ll code up the arduino so that when we push the button, the led lights up.
First circuit: power is coming out of pin8
Through the board,
Into the LED making it light up,
Then back through the board,
Down the ground rail
And into the ground pin of the arduino.
Second circuit is a little more involved.
Power flows from the 5v power rail on the arduino
Into the breadboard,
Through the button,
And then needs to make a choice:
It can go either through the breadboard and into the arduino pin 3 so we can read the state, or go to ground.
Which path will it follow?
Whichever path has the least resistance
Does anyone want to help put this together?
… for reference
REMEMBER THE NEXT SLIDE FOR THE CODE PROCESS
The programming process – and this is true for every embedded thingy I’ve worked on – is to write and compile code on the PC, then upload it to the device.
On arduino this happens over the USB cable (which I forgot – LOLz)
Once the code is on the device, it runs until there are no more electrons flowing through the processor.
The final project I want to build here is a build status indicator.
Standard CI workflow:
Commit code
CI server builds code
Developer receives notification
- email, twitter, RSS, dashboard
Replace the CI notification using an arduino
We’re using LEDs for simplicity, but you can replace that part of the circuit with something more creative. But this’ll get the point across.
Let’s build it…
VS code change and commit
Run build on TC server
If you enjoyed this talk….
Go forth and break stuff…