All posts by Jeremy Costin

Relays

How to Use Relays

About: Relays are on and off switches for electronics.

Why are they significant? Higher powered circuits can ruin lower powered components. For example, powering a large motor with an Arduino board will not end well for the Arduino. The relay allows higher powered components to interact with lower powered components without the risk of damage.

Prerequisites: Before following these instructions, you should know about open and closed circuits. You should also be able to understand a basic electrical schematic.

Introduction to the pins:

Input pins:

  • VCC – this pin should be connected to +5v at all times
  • GND – this pin should be connected to ground at all times
  • IN – this pin switches on and off in the relay.

– If it receives 0v, the relay is in its normal state.

– If it receives +5v, it is not in its normal state.

– IN is sometimes called “Digital Pin” or just “D.”

Output pins:

  • COM – this pin will always be used in a circuit; it is the pin that is measured from.

–     NC       – (Normally Closed) this pin closes circuit with COM when relay is in it’s normal state.

  • NO – (Normally Open) this pin forms an open circuit with COM when the relay.

 

Examples of use:

Let’s say you have a gigantic light bulb (or any electronic component that uses a lot of power) and you need to be able to switch it on and off with an Arduino. The big light bulb needs a big battery to power it, but that amount of power would burn the Arduino to a crisp. The solution is to use a relay.

As you can see, the +5v pin on the Arduino is attached to the VCC pin on the relay and the GND pin on the Arduino is connected to the GND pin on the relay. The IN pin on the relay is connected to the digital pin on the Arduino that will control the circuit.

Because Circuit 2 is connected to the NC pin, the circuit will be closed and the lightbulb will be on when the digital pin on the Arduino is off (the “normal” state). The lightbulb will be off when the digital pin on the Arduino is on. If it was connected to the NO pin, the opposite would happen.

Testing a relay:

To test your relay, use the blink sketch. Attach VCC to +5v, GND to ground, and IN to whichever pin is blinking (13, usually). If you hear the relay clicking on and off every second, you are good to go!

Advice:

  • If your relay stops working with your program, always go back to the blink sketch. If that sketch works then there must be something wrong with your program.
  • Instead of plugging VCC, GND, and IN pin using male wires, you can put all three of those pins into the three male wires on the arduino board usually located right next to the digital pins. Just make sure everything is lined up correctly.

External help:

Here’s just a list of resources which may help you with relays.

Ordering relays:

Here is the type of relay we used:

http://www.amazon.com/dp/B009T2M012/ref=sr_ph?ie=UTF8&qid=1433769066&sr=1&keywords=relays

If you don’t get that exact type, try to find something similar—nothing too fancy is necessary.

Also you can either get a single relay per unit or dual relay module (same thing except 2 relays are there per unit)

Happy relaying!

By, Jeremy Costin, Nathaniel Rosenbloom and Amber Zedeck

-Class of 2017

MIT App inventor and creator

I learned how to use MIT’s App Inventor this year in order to create an app for my product, On Track. The app inventor software is a free user-friendly interface that allows you to create an Android-accessible app with various functions including user interface, layout, media, drawing and animation, sensor, social and connectivity options (all to be found under the palette list on the left side of the website). For our specific project, we needed a way for users to see how many seats were available on a certain car on a train. app inventor allowed us to create an app that would let the user select the train stations they were departing from and arriving to, the time of the train they are riding on and then based on those selections, determine which car has what number of available seats.

I think the beauty of this interface is it is really easy to pick up, especially with the help of tutorials. I highly recommend watching the tutorials to familiarize yourself with the basic uses for app inventor. The first one I watched, (http://www.youtube.com/embed/Vdo8UdkgDD8?autoplay=1) was dealing with a Text-To-Speech component. All of the basic tutorials can be found here: http://appinventor.mit.edu/explore/ai2/beginner-videos.html. At first I found them quite tedious (the people who teach the tutorials are very annoying), and I felt like it was a waste of time to be checking out all of these random mechanisms, but once I got to building my own app, I found that the logic skills and the understanding of what the various components are good for that I learned from these videos to be incredibly vital. So, my biggest recommendation is to play around with a bunch of components, see what works and what doesn’t, and then morph the stuff that you figure out to fit your own personal app and meet your requirements. The app I ended up creating only really used buttons, lists and images (all of these options can be found under the user interface tab under palette), but, if I do say myself, it still looked very professional and met our functionality requirement, which leads me to my next piece of advice: keep it simple. If the logic behind a particular component gets confusing, use the very simple buttons and pictures to replicate what your fully functioning app would look like. In all fairness, our app wasn’t perfectly functional in that it didn’t connect to the train car that we built, but it was a mock app that got the intention of our app across to the VC, and with the simplicity of the mechanisms we used, it seemed to perfectly functional.

I hope this was helpful! Keep coding!

 

Maddie Burton

Class of 2017

Arduino Real Time Clock

This year, I spent much of my time programming and wiring the Arduino Real Time Clock (RTC) This Arduino is a microcontroller, a small computer that, depending on what you connect to the Arduino board and what code you upload to it, can blink a light, display something on a screen or even sense your location.The RTC allows the Arduino to keep accurate time, allowing it to display a timer, the current time, and it can keep time so the Arduino can do something at a specific time. Originally, I thought that we were just going to use the RTC to show the current time and that we were going to use a different method, the Arduino “CountUpDownTimer” library to display a stopwatch. Getting the RTC to show the current time only took a few weeks. Here’s a great Adafruit tutorial that I used. However, there are a few issues with the code it gives you. You must make every mention of “rtc” lowercase. I did not realize how case-sensitive coding was. The other important thing is to make sure to uncomment this line “RTC.adjust(DateTime(__DATE__, __TIME__));”.   That line is crucial, as it is what allows the Arduino to display the accurate current time. When I started using the RTC, I did not realize that it could be used as a timer as well as a clock. I wasted three months using the CountUpDownTimer library, and it never worked well. Here is the library for the RTC that I used. In order to write a code for the timer, I had to learn about reading a header file and how to understand the different types of commands that you can use in the code. I also learned that it causes horrible lags to have the RTC update seconds for three timers at once. When I tried doing that, all of the timers were running on a three second delay. Another lesson that I learned is that it is very difficult to use the RTC with the LCD_I2C because they require the same pins. It is easier to wire the LCD the long way, so you can decide what pins it will use. Perhaps the most important lesson I learned through this process is that you MUST NOT wire the Arduino while it is being powered. When I did this by accident, electrostatic discharge occurred and I ended up with a lovely red bump on my thumb for a few weeks after shocking myself by touching the RTC while wiring it.

–By Marc Szechter Class of 2018

Drilling (using both the Drill Press and the handheld drill)

Drilling is a simple yet incredibly important fabrication technique. Basically, it creates a hole where you need a hole. This is useful for attaching materials via screws, string/rope, zip ties, and other connections. In our fabrication-centric product, we need to affix many different components together. Drilling was crucial for our use of screws in the chassis, PVC frame, and wooden enclosure. We also drilled holes in the rubber belt to sew the two ends together.

Much of our learning of drilling was hands on or learning through experience. That being said, it is critical to take safety precautions before diving in. These include ALWAYS wearing safety glasses even though they aren’t always comfortable or may not go with your outfit and even if you are just watching you should also be wearing safety glasses as well. Drilling produces lots of scrap material, such as dust and shards, which would hurt quite a bit if they landed in your eyes. Also, tie back any long hair so as to avoid a painful makeover. Lastly, ask Dr. Aviv for the machine key, if you are using the drill press.

I always prefer to use the drill press when available, as it is steadier and easier to use. However, if the material does not fit onto the drill press’s table (platform with hole), you will have to use a handheld drill. The first step for both drills is figure out what size hole you need and find the corresponding drill bit. Attach the bit to the drill head by loosening then tightening the chuck (jaws). Make sure the bit is directly centered– if it isn’t, you won’t be able to drill a perfectly circular hole. Next, mark the area you want to drill with a pencil, marker, paint, etc.

If you are using the press, clamp the material to the table using a spring clamp or a vise, lining up the mark with the bit (this is really important because if it is not lined up then you will drill the hole in the wrong place). If the material cannot be clamped, have a friend carefully hold the ends, keeping their fingers clear of the bit. Turn on the drill and slowly lower the bit through the material. Once you have drilled through, keep the power on and raise the bit out of the hole slowly to help remove any debris. If you are using the handheld drill, clamp the material to a worktable in the same fashion, but make sure you won’t drill into the table itself. Turn on the drill and push the bit into the material, slowly but with firm pressure. Once you had drilled through, keep the drill bit spinning as you pull it out to clean the hole of debris. With both types of drills, keep a vacuum handy in order to deal with the any of the remaining debris (including dust) One of the most important things to remember is never try to drill something that isn’t clamped or held down to the table. Also, you must lower the bit into a material; it cannot start out inside of it. Here’s a fun anecdote about what happens if you don’t follow these simple guidelines: We had already drilled a hole in a piece of wood but wanted to make it cleaner. So I put the bit through the previously drilled hole, held the wood, and turned on the drill press. The piece of wood spun right out of my hands, cutting my fingers in the process of becoming a dangerous wooden saw of pain. Moral of the story is to always line up the bit and lower it through the material.

Here are a couple of helpful websites to use if you want to do more research on how to drill:

http://www.bobvila.com/articles/2123-operating-a-drill-press/#.V09eCpMrKmE

http://www.diynetwork.com/how-to/skills-and-know-how/tools/how-to-use-a-drill-press

http://www.planitdiy.com/how-to/garage-workshop/how-to-drill-holes/

 

Written by Benjy Robinov Class of 2017