Category Archives: arduino

Cheap sensor help students answer real questions

I gave a presentation a couple months ago at the Spring meeting of the Michigan section of the American Association of Physics Teachers highlighting a project a pair of my electronics students did last school year. My students used an Arduino to read a 250g accelerometer to investigate the force a brain might feel in a violent football tackle.

From an Arduino point of view it was a trivial program. However, it was still a cool project for a variety of reasons. There were many opportunities for problem solving. They had to figure out how to embed the sensor in a meangingfull way, mount the helmet, and simulate a rough tackle. First task was determining how to mount the sensor. They asked if they could 3D print a head. This seemed reasonable to me, but I wasn’t sure if they’d have to design it or if we could find one. The head of Stephen Colbert was readily available and made us laugh, so that’s the one we printed after modifying it to accommodate the sensor. In retrospect this was not the best head to print as Colbert’s hair when 3D printed doesn’t squish the way real hair would. For this project it worked out fine, but for a side impact would not be ideal.

3D Printed Stephen Colbert in Helmet
I really like this project because it gave students a chance to investigate something of interest to them that is also very topical. As football players, this was of direct interest to them and something with wider potential impact as well. When they finished it I immediately wanted to share this project with other physics teachers. It would be cool to see other teachers working with their own students to do similar projects. However, whenever I try to show teachers how to use Arduinos to collect data, their eyes start glaze over as soon as the code hits the screen.

I decided to attempt to meet my physics colleagues where they are rather than where I am. Most of the physics teachers I know have access to either Vernier or Pasco interfaces and sensors. At our school we have Vernier, so that’s what I used. I assume you could do something very similar with Pasco equipment.  Vernier sells a cable you can use to make your own analog probeware. It turns out this was very easy to attach to our $30 accelerometer.

img_0322.jpg

The Black Wire goes to GND, the Orange Wire is +5V so goes to the VCC, and the Red Wire attaches to OUT. The other wires were not used. All you need to do is solder these three wires to the sensor and plug it into a LabQuest or LabPro. This is something pretty much anybody can do. However, if you’ve never soldered before I recommend this tutorial from SparkFun Electronics.

The 250g Accelerometer we used is an analog sensor. This makes it easy to interface with Vernier hardware. Nerd Alert: If you need to know, basically we are using it as a voltage comparator. On the LabQuest (or LabPro) we set up our sensor to read Raw Voltage (0 – 5V). For our sensor, zero volts corresponds to -250g’s, five volts with 250g’s, and at 2.5 V we have zero g’s. In reality the 5 V wire gave me 5.2 V (the USB standard is 5 V but can be up to 5.25 V or as low as 4.4 V), so zero g’s was at 2.6 V and 250 g’s would be 5.2 V. Since the output from this sensor is linear, I used the LoggerPro program to convert the voltage readings to g’s by creating a “New Calculated Column”. I ended up with a slope of (500 g’s)/(5.2 V) and a y-intercept of -250 g’s.

Screen Shot 2016-07-28 at 8.36.54 PM

The graph of my calculated column resulted in a graph of force vs. time. In the example graph below, the hit lasted for about 0.003 s and reached a peak of just over 63 g’s. Based on readings from the literature, a hit of this magnitude and duration would be unlikely to cause a concussion.

Football graph

With the growth of the Maker Movement there are now a lot of cheap sensors out there that can be interfaced in exactly the same way. Adafruit makes a 200g 3-axis accelerometer that looks promising, but you’d need 3 Vernier cables to read all thee axises simultaneously (also true with Vernier’s 3-Axis Accelerometer).  I’ve also been thinking about using some flexiforce pressure sensors to measure the force/area actually applied to the head in a collision. This would be a simple modification of this lesson on the Vernier site.

Arduino RC Car Part 2

Tony DiLaura asked me about tutorials for high school students to build Arduino controlled RC cars. I didn’t really know of any that I liked so I started outlining what one might look like. This is part two, you might want to check out part one first. This post will be about control mechanisms.

In my last post I said my students had never made remote controlled cars. It turns out this was not at all correct. I’m getting too old and the memory begins to fade. It’s a good thing the internet never forgets. In this post I’ll share some that my students have made in the past. In the next post I’ll dive into ones I’ve seen on the net but haven’t tried yet.

Wiichuck

WiiChuck carOK, this one isn’t radio controlled, but wired instead. It uses the Wii Nunchuck to control your circuit. I suppose if you have a wireless nunchuck you could also make this wireless. If you have to buy a nunchuck this might not be the cheapest option, but I bet one of your students has one at home in a closet somewhere. You can chop the end of the Wiimote plug or you can buy a cheap adapter

  • SparkFun $1.56 – Cheapest and I’ve used this one in the past
  • Adafruit $3.00 – Might be a better option. Looks like it’s designed to snap in and stay in a bit better.
  • WiiChuck Page – All about using a WiiChuck with Arduino including a library download
  • Lego – Lego Electronic GizmO – Lego robot controlled by Arduino and Wiichuck created by my students several years ago. Includes some sample code. Uses the joystick because the accelerometer was a bit too twitchy for them. That could have been solved with programming.

TV Remote

zwally-IR RobotWe’ve also had luck controlling Arduino robots with old TV or VCR remotes. Be aware that some work far better for this than others. The only way to know is to experiment. This is really in the same price range as the Wiichuck solution and makes your car wireless as long as you have line of sight. In theory, you could also create your own remote using a second Arduino and IR LED, but I’ve never done this.

Keyfob

rf receiverI’ve also had students use a keyfob transmitter and receiver. This uses RF and is probably the simplest from a programming standpoint. If your students can program an Arduino to respond to a button press then they know everything they need to to make this work. I don’t have any links to the modules my students used. I can’t remember where I bought them from. Which is probably just as well, they worked, but were not great. However, I did find virtually the same thing on Adafruit’s website. I trust Adafruit to have good stuff.

 

Tutorial for an Arduino RC Car?

A buddy of mine recently sent me a tweet:

RC Arduino Tweet

This is an interesting question the short answer I have is, “No.” The longer answer is a bit more nuanced, so I asked for a little clarification. This is what I got back:

RC Arduino 2

Now I had a lot more to go on. With this in mind I have something to sink my teeth into. Now we have something, so now my response is, “No, I haven’t seen anything that would fit.”

OK, now that that’s out of the way lets cover how I would tackle this problem. Tony is an awesome math teacher in Zeeland, Michigan. He co-teaches a project based math/physics class. I’m going to work from the assumption that he’s working with students starting with little previous knowledge of electronics and Arduino programming, and that he’d like to leave as much room as possible for students to explore. Everything I cover will be with that in mind.

With a project like this you need break it up into pieces. I’m going to think of this as a robot even though it won’t be autonomous because we still will have a computer controlling an independently moving device. As with any robot type project you have three fundamental challenges, the programming, the electronics, and the mechanics. However, with this project we’ll need to consider a forth part I don’t usually think about with a robot, and that is the control mechanism.

Mechanics

You could go crazy with this and start with a platform like Tuggy from the very cool OpenRC Project. While totally awesome I think this takes all of the thinking away from the students and simply turns them into mechanics. Which is fine if that’s your goal. Instead I’d start with ThinkFun’s MakerStudio collection of building sets.

macaroni box car

You can buy sets or download and print from the Thingiverse. I’d start by having students play with the gears and such and make simple cars with parts available, then begin thinking about what their RC car needs. They’ll need to make a variety of decisions. How will their cars be steered? Will they use skid steering (like a tank) or rack and pinion (like a car)? What sort of  platform will they need? I’m not sure a Mac & Cheese box is the best choice. How many motors will they need? Will they use gearbox motors or simple DC motors and then use the gears in the set? Some of these decisions might be made by the teacher and some or all might be left out the students. I’d probably go with simple DC motors and use the gears from the set.

Once these decisions have been made students can then think about the parts in the MakerStudio kits they don’t have but need. Things like motor mounts, rack and pinion mechanisms, bits to mount the gears to the platform of choice, and such. These could should all be designed and 3D printed by the students.

Electronics

Tony asked for Arduino, so we’ll stick with that. It also doesn’t hurt that I know a lot about using Arduinos with high school students. Unfortunately, you can’t run any sort of reasonable motor directly from an Arduino. You need some sort of transistor or h-bridge. Digital outputs on your Arduino only put out 40 mA, this is woefully inadequate to power a motor.


Students can wire an h-bridge themselves, but I highly recommend using a motor shield. I’ve had many students use an h-bridge and breadboard their circuit which mostly works. There are a lot of connections that need to be made and by the time students got to soldering stuff together numerous problems would typically crop up. In order to get around a lot of headaches I now have students use motor shields and skip all the complex wiring. You can buy shields from China really cheaply, but I like to use SparkFun Electronics. SparkFun is based out of Colorado and they offer an educator discount of 20% and allow you to easily set up payment accounts allowing you to pay via purchase order. The other thing I really like about SparkFun is that they include code example and/or tutorials for almost everything they sell. So I can hand a shield to a student and then point them to the product page and step back.

Most motor shields will allow you to control two motors, perfect for skid steering. If your students chose to go with rack and pinion then you can get away with one drive motor, but you’ll need a servo-motor for steering. There are lots of tutorials for controlling servos with Arduino and ideally where ever you get your motor shield will tell you how to wire your motors to it and give you a simple program to control your motor(s).

Other Stuff

At this point we just have programming and control mechanism left. I have some ideas about control mechanisms, but I haven’t done any of these in the past. When I say “I” that really means my students. So, I’m going to do a little more research and then another post. More than likely I’ll be looking at some sort of the cool BlueTooth module and an app running on a cellphone or tablet. There are other ways, but controlling a robot with your phone is just too cool.

Arduino in High School Electronics

I started using Arduino, an open source electronics platform in my one semester electronics course. Arduino incorporates a microcontroller (mini computer) and allows for a lot of really cool options. Last semester was the first semester I used Arduino with the whole class. It went fairly well.

All students were required to create a final project. I gave them the option of working with a partner with the caveat that when they presented their final project I would get to decided which of the two of them would have to answer my questions.

Their projects included not only the circuitry and programming, but students also had to physically build the device. This ended up being a really good project. Even if they chose to build upon a project they found on the net they had to tinker with it to make it do what they wanted it to do.

Once completed, students had to write up and present their projects on Google Sites. If you’re interested you can go to the class site to find descriptions, pictures and Arduino code. Below is a video created by a pair of my students who used an old remote controlled car as the chassis for an autonomous Arduino controlled robot.


Crossposted from FlosScience

Arduino – eeePC Nightmare!!!

So, I decided to totally change the way I teach my electronics class. It will now center around the Arduino microcontroller, a platform that uses an Atmel ATmega 64/128 microcontorller. Anyway, I don’t really have enough laptops to go around, so I scrounged some funds together and bought two of the Asus eeePC 2G Surfs. I figured these would be just about perfect.

Problem #1: Java, which is needed for Arduino doesn’t come on the 2G Surf. So, after searching for a way to get it on the 2G Surf for a few hours I find it. It installs and all is good.

Problem #2: To really make the Arduino sing I also need Processing. Unfortunately there’s not enough room left to fit it.

Problem #3: After a bit more searching I find a way to delete stuff I’m never going to need (like Chinese language support) from the eeePC. Unfortunately this makes no space available to me.

Apparently there are two main partitions on the eeePC. One for the user to do whatever they want and one that the user really can’t touch. All the programs come installed in the one the user really can’t touch.

Solution? After maybe 10 hours yesterday and another 7 hours today I think I may have this licked. I’ll write up process and post it to FLOSScience for those interested. If I’m right I should be able to capture am image of my one working one and put it on the other one. This would take less than 5 minutes, otherwise I’ll be looking at at least another 2-3 hours to get the other one set.

Better Solution? Get the 4G version ($50 more).

Arduino or PICAXE?

This is a pretty geeky post… You’ve been warned.

Among the courses I teach is electronics. It is a one semester course, where we cover basic theory in the first half of the semester and students breadboard circuits for the second half of the semester. I inherited the course and its general structure from the previous electronics teacher and it seems to work pretty well.

Anyway, I’ve been thinking about changing it. I’ve been wanting to incorporate microprocessors into the course for some time, but I’ve been daunted with either the price tag or for the cheap stuff with the technical know-how that I just don’t have. By bringing in microprocessors I can also get students doing some programming . Additionally, a lot of electronics these days includes embedded microprocessors.

Enter the PICAXE and Arduino micro-controllers. Both can be had relatively cheaply and are fairly easy to program. Unfortunately I discovered these at about the same time. If I only knew about one of them I’d have been content to buy a bunch and get to work redesigning my course. As it stands right now, I have no idea which one to choose. So I’m writing this post to get my ideas down and I’m partly hoping for some insight from potential experts.

PICAXE: The PICAXE micro-controller is a Pic based chip that has a bootloader loaded onto it allowing for a very simply programming cable to be used. It can be programmed using a form of basic or with a flow chart based interface. There are some great guides online for its use, but they’d have to be edited a bit to make them usable for my course. There are multiple versions of this chip with different numbers of inputs/outputs. The programming is slightly different from chip to chip.

Pros: Cost. The chip (8M) itself costs less than $4. Theoretically students could easily make permanent projects with this. Basic programming: I know basic and basic programming is relatively easy.

Cons: The 8M, the chip I’d focus on, is a bit limited. There are other chips we could add in, but their structure is different. Apparently limited availability. I’d really have to plan ahead to ensure I had the supplies I’d need (unless I want to order from the UK). Windows only.

Arduino: This board is really a Basic Stamp replacement. I’d thought it was going to be outside of the price range I’d set for the course, but then I found a supplier who supplies a version that I can get for $11/board in bulk. The programming for this chip is in a C++ like language. There is also a lot online support for this board and at least one project designing a course in basic electronics with the Arduino as the platform.

Pros: Expandability. This chip has some wickedly cool potential. It interfaces circuitry directly with a computer easily, making it possible to create circuits that control or respond to functions on the computer. Support for Mac, WinXP, and Linux.

Cons: I don’t know C++ or any other object oriented programming language. More expensive so it would cost more for students to make permanent projects.

I guess the bottom line is the PICAXE is probably simpler to start using but while the Arduino has a steeper learning curve at the start it allows for more advanced functions more easily. At least I think. Right now I’m leaning towards the Arduino. I’ve already got one independant student working with the PICAXE. I’ll get a couple working with the Arduino this semester as well and see what they all think.