Monday, April 9, 2018

Adding Aux Input to 2006 Toyota Corolla

As I am going to start driving soon, I'd like to be able to listen to music from my phone in the car. I'll be driving a 2006 Toyota Corolla, which has a CD drive and radio, but no Bluetooth, USB, or aux input. An older car with a cassette tape drive would've actually been better, because there are cassette to aux adapters that can be bought for fairly cheap. I tried to use a device which connects to a specific radio station and routes the aux output from your phone to that station. While this device worked and met its claims, the audio quality wasn't great, and there were some instances where there would be a lot of radio static noise. I wasn't satisfied with this. I did some research online and found a cheap device which plugs into an empty slot of the entertainment system and acts as a another input by identifying itself as another CD. I purchased this product from Amazon for around $20, and watched some tutorials online on how to install it. The installation process is fairly simple, just removing the plastics panels in order to gain access to the entertainment unit. Next, I plugged the device into the empty slot at the back of the system and routed the aux cable out near the center console. Finally, I tested if the whole thing worked, and it did. The quality is better, but the main benefit is the stable playback. This is because the audio isn't being transmitted over radio. In the future, I plan to add Bluetooth by attaching a cheap aux-Bluetooth adapter to the aux cable. 

Monday, March 26, 2018

GPS Lockbox

I recently completed a project for my computer science project in school. The project was an end of the year type thing, and it was to make anything you wanted using code. Most other people made apps or games, but I wanted to do something with hardware. My partner and I came up with the idea to make a box that only unlocks itself when it is within a set radius of a location. I already had a Raspberry Pi, so I planned to use that. To open the box, we used a servo motor from an RC plane. I ended up purchasing a GPS module for the Raspberry Pi and a small LCD screen to print out location data. Getting the GPS to interface with the RPi was pretty hard. I watched a lot of Youtube videos and did a lot of research before finally being able to receive some data. However, this data just looked like random strings of different characters. I did some more research and found that GPS uses special tags in front of different data to identify what type it is. For example, the string "GPRMS$" will be in front of the date and time data. I found the tag for latitude and longitude data and wrote some code in Python to only print out the latitude and longitude. Next, I had to figure out how to make sure the device was within the radius of a set lat/long. I found a mathematical formula online called the Haversine formula that could be implemented in my code. It takes in destination and current location coordinates and spits out the distance between the two, taking into account the earth's curvature. After doing some tuning and testing of the coordinates, the code worked. I figured out how to control the servo motor with the Raspberry Pi using PWM (Pulse With Modulation) and added the servo control part to my existing GPS code. I cleaned up the final code a bit so that the data being outputted to the LCD screen was more reader-friendly and usable. Finally, I put all the hardware components into a plastic container I found lying around and created a simple locking mechanism with some old Lego pieces and hot glue (this box is really easy to get into even when it was locked, but it was meant to be a proof of concept). The RPi was powered by a portable charger and the LCD from a 9V battery. This made the whole setup portable, so you could walk towards the location and watch the current lat/long. change. Overall, the whole project was a success. I learned about GPS and got better at programming in Python during this experience. See pictures and code here
Entire Assembly 

Raspberry Pi Code

Locked Position

Unlocked Position

Servo connected to GPIO Pins

Command Line UX

GPS module via GPIO

Pi and GPS module

Saturday, January 13, 2018

DIY Amazon Echo

The Amazon Echo devices running the Alexa AI voice assistant have been gaining a lot of popularity lately. While the new Echo costs $100, the Echo Dot costs $35-$50 depending on if there is a sale. At that price, the Echo Dot is very affordable and practical, and the sales have shown that people agree with me on that. After recently purchasing two smart switches to control lights in my room, I was interested in purchasing an Echo Dot for myself. But then I realized that I could build my own for a little cheaper. An actual Echo would have more features and better components, but I wanted to have some fun and build my own. I found many articles and videos online on how to do this project. The key parts of this project are a Raspberry Pi running special Amazon software, a USB microphone, and some sort of wired speaker. I had an original Raspberry Pi Model B (the first one) sitting around after I had used it to make a retro video game emulation box, so I decided to use it. I also had an old webcam with a mic, so I used that as well, along with a Bose SoundLink speaker (with aux input). I installed Raspian (a Linux based operating system for the RPi), and followed directions from this website to configure all the Amazon software. Essentially, you sign up for a free Amazon Developers account, register a product, enter some product info into some software that you install on the RPi, and it all works pretty well. I had a few issues regarding the mic being detected and the software responding to me saying "Alexa", but I found very helpful advice that solved my problems on various forums, usually on Reddit or GitHub (the software that actually runs the Alexa platform on the RPi is from a GitHub developer). Another tip that might help you is using SSH. SSH is a method to access your Raspberry Pi from another computer over the internet. This means that you don't have to hook up a display to the RPi, instead just receive a visual feed on any internet-connected computer. Setting up the SSH is fairly simple, and was a breeze for me. Again, there are many videos and articles about this to help you. After some testing with my Echo, I realized that the RPi wasn't able to read long articles or play music without some buffering or glitching. I suspected that this was due to the lack of processing power in my old RPi, so I bought the newest RPi model on Amazon (the RPi 3) for $35. I also bought a far-field sensitive USB mic to replace my old webcam. After reinstalling the Amazon software on my new RPi, everything worked as planned and just how I expected it to. To finish it off, I 3D printed a mount for the RPi so it could stand upright, and cleaned up the cables. This AlexaPi (as many call it), can do almost everything a regular Echo Dot can do, except play music without using the Alexa app (the actual Echo can do it through voice command). Also, the far-field mics on the actual Echo are better than the cheap mic I got on Amazon as well. With most of my projects, it usually takes me a while before a desirable result is reached. However, this project was a lot easier than I thought it would be, and I think most people who simply follow instructions could do it with ease. While the actual Amazon Echo Dot is more practical in terms of price (if you don't already have a RPi, mic, speaker), I like that I built my own. Whenever you build something on your own instead of buying it, all your work pays off, and you get a feeling of accomplishment and achievement. 

Friday, December 15, 2017

Building a Boosted Board

If you don't know already, electric skateboards have been becoming more and more popular, mostly due to a Silicon Valley startup known as Boosted. They are the Apple of electric skateboards, and accordingly, their boards go for as much as $1500. When I saw YouTube star Casey Neistat riding a Boosted Board around, I really wanted one for myself. However, I don't have $1500 lying around.  I realized that the actual parts cost for the Boosted Board was much less than the selling price. I understand that Boosted needs to make a profit and all, but I figured that I could do it for much less. I started by researching the parts and watching a lot of YouTube tutorials. Everyone who built one pretty much used the same components: A motor around 200-300KV(KV is short for kilovolt, and the higher a KV is, the faster a motor spins), some type of electronic speed controller (ESC), two or one big Li-Po (Lithium-Polymer) batteries, and an enclosure to hold everything. I tried to find the cheapest parts that would still offer good performance. After a lot of researching, I chose a 280KV motor from Turnigy, two 3s 3000mAH Zippy batteries, a 150A RC car ESC and a waterproof plastic fishing bait box from Walmart. For the actual board itself, I bought a cheap longboard off of Amazon (parts link will be below), a motor mounting kit, and some larger 80mm wheels. After all the parts arrived, I was faced with a few problems to solve. First, setting up the pulley system. The wheels I ordered had spaces in them that made fitting bolts in them easy. The bolts threaded into a circular sprocket gear that was affixed to one of the skateboard wheels. Yes, this skateboard is one-wheel drive, but so are other commercial electric skateboards. Next, I had to attach the motor mount onto the skateboard truck (the thing holding the axle to the board). This part of the build took a lot of time, as I had to file down the metal skateboard truck in order to fit the hole of the motor mounting plate. At the hole, the mounting plate was secured by three grub screws (basically bits of thread that hold something to another object with friction). After I managed to get a secure fit between the motor mount and the skateboard truck, I moved onto fitting the pulley gear onto the motor shaft. The motor screwed into the motor mount just fine, however, my pulley gear had a bore of 8mm, while my motor shaft was about 6mm. I had to order a separate pulley gear online that had a bore of 6mm for the project to continue. This is important - don't assume the parts will all work together. Next, I focused on the electronics, which were surprisingly easy to put together. After confirming that motor was spinning in the correct direction (you can reverse motor direction by switching any two of the 3 motor wires that go to the ESC), I soldered the ESC to the motor. Next, I soldered the two batteries together in series. Series means that one negative of one battery and one positive of the other battery are soldered together, and the remaining positive of one battery and negative of the other battery are used to output power. After soldering the ESC to the battery, I plugged in my RC car receiver. I bought an RC car transmitter and receiver on Amazon, but I plan to return it for a transmitter and receiver that are actually made for an electric skateboard. The RC car transmitter and receiver work perfectly fine, but the transmitter is kind of bulky. I drilled some holes into the skateboard and mounted the plastic fish bait box from Walmart to the bottom of the board with nuts and bolts. I had to shave off some of  the plastic compartments in the box so that my electronics would fit. I cut a hole for the ESC (for ventilation - gets very hot) and for turning the board on (ESC was wired to a on/off switch out of the box). After that, I fired it up and tried the board without my weight on it. It seemed to work fine, but once I got on it, the throttle response was way too jerky. I trimmed/adjusted settings on the throttle on my transmitter, and then I was able to actually ride the board. I had never ridden a skateboard prior to this build, so I practiced a bit before without a motor. I found that starting the motor with a moving start in the direction you want to go in helped with stability. I went to a local park and tested the board there, and it worked very nicely. In terms of charging, you will need two balance chargers or one multi charger to juice up your batteries(there are separate charging cables on most LiPo's, so don't worry about soldering the batteries together). I already had a few balance chargers lying around that I used for my drone batteries, so I was good to charge. The chargers that I use are very inexpensive, and can be purchased from Hobbyking.com. I haven't yet tested top speed and range, but I will report that info to you guys in a follow up post. Back to the main reason I started this - building my own Boosted Board on a budget. I think I pretty much accomplished my goal. I don't have a fancy app for my board, two wheel drive, a bamboo deck or fast charging, but in essence, I built a practical method of transport that's not only fun to ride, but fun to build.
Here's a video of me riding the board: Skateboard Video
Parts List:
- 3s 5000 Zippy LiPo x2: $43.76 - Hobbyking
- 280kv Turnigy Aerodrive Motor: $46.96 - Hobbyking
- ‎Hobbyking 1:8 Scale 150A ESC: $73.20 - Hobbyking
- ‎Turnigy Twin Pack Charge Lead: $1.99 - Hobbyking
- ‎83mm Longboard Wheels: $26.99 - Amazon
- ‎Motor Mount and Pulley: $29.99 - Amazon
- ‎Magic Union 41" Longboard: $45.99 - Amazon
- ‎HTD 3M 15 Tooth Timing Pulley: $13.88 - Amazon
- ‎FlySky FS-GT2B 3ch Transmitter and Receiver: $28.99 - Amazon
- ‎Waterproof Fishing Bait Box: $7.75 - Walmart
- Turnigy 12V 2-3s Balance Charger: $5.00 - Hobbyking
- 12V DC Power Adapter: $10.00 - Amazon



Monday, August 14, 2017

More on the IOT

When I discussed the New Matter MOD-t printer, I explained a feature that allowed for remote printing and monitoring. A 3D printer connected to the Internet. A coffee maker connected to the internet. A lawnmower connected to the Internet. A thermostat connected to the Internet. These days, more and more things are getting connected. The devices and links between them are known as the Internet of Things. I recently purchased two Belkin Wemo Smart Plugs to control lights in my room. The devices plug into a socket, and you can plug anything you want into the Wemo. This allows for a lot of flexibility, because a lot of things inside your house plug into the wall. Also, you can plug a power strip into a Wemo to toggle multiple devices at once. In my setup, I have one Wemo controlling a lamp in the corner, and then another Wemo that is hooked up to a power strip controlling two lights near my desk. The setup process is extremely easy, just requiring you to connect your Wemo plug(s) to your home Wi-Fi network and give each plug a name. After the initial setup through the Wemo app, you are greeted with a screen that has switches for each of the plugs and more settings. The app is great, but for even more convenience, I linked the Wemo plugs with the Google Assistant on my Android phone. In the Google Assistant settings, I was able to set catch phrases to trigger different actions. Now I can say "Ok Google, turn on the Desk Lights," and the two lights near my desk will switch on in a few seconds. You can also get creative and make up phrases. For example, when I say "Good night" to Google Assistant, it turns off all the lights. I feel that smart plugs like these are the best way to get into home automation. You don't need much, just an Internet connection, device with digital assistant (Siri, Alexa, Google Assistant) and available power outlets. Also, you pay a reasonable $30 for one Wemo. The Internet is evolving, and reaching almost everything that has electricity in it. These Wemo plugs won't start the Matrix, but are indeed a start to a new way of interacting with the things around you. The convenience of home automation is amazing, and shows how our lives and environment will be connected to the Internet.

Friday, July 14, 2017

Brief Explanation of 3D Printer Settings

In my last post, I described the New Matter online slicer program including certain settings. I mentioned raft/brim, speed, layer height and supports. All these settings are usually found in most slicing softwares. First, let's start with raft/brim. For your model to print well, it needs to stick well to the print surface. A brim makes the printer print a few layers around the base of your model to ensure that your extruder is extruding properly. This prevents under/over extrusion or small plastic blobs that can develop. Brims do not waste much material and are fairly quick, so I'd recommend using them on most of your prints. A raft in 3D printing works kind of like raft in the water. A few layers are printed under the base of your model, giving it more strength at the base and good adhesion. Rafts are good if your model only has a few points touching the bed at the start of the print, but are not necessary for models with fairly solid bases, as they can add more time to the print. Speed is self explanatory, it's the rate at which the printer extrudes plastic, and is measured in millimeters per second (mm/s). Raising speed may result in sloppy layering and weaker prints, so test speeds to see which one is best (usually stick with the default in program). Layer height is a setting that can change the finish and speed of your print. If you have thicker layers, the print will finish faster, but will have pretty noticeable ridges and won't feel smooth. On the contrary, thinner layer height will make the print look almost as one piece, but will take longer. Thinner layers will make the print weaker, and thicker layers will make the print stronger. Layer height can be compared to building a wall out of bricks. The thicker the bricks are, the faster the wall will be built, but you will be able to see the individual bricks from a distance, and the opposite goes for thinner bricks. Layer height is measured in millimeters, and is based on the printer nozzle. The most common nozzle diameter is 0.4 mm, meaning the printer can extruder at a max thickness of 0.4 mm. The thinnest layer height most printers allow is 0.1 mm. Essentially, the filament, which is usually 1.75mm in diameter, is being melted and thinned to a max of 0.4 mm and a minimum of 0.1 mm. The printer extrudes less filament to get a thinner layer height. The filament diameter, nozzle diameter, and thinnest layer height can be different between printers, but the values above are most common. Layer height can also be measured in microns; 0.4 mm = 400 microns, 0.1mm = 100 microns, 0.05mm = 50 microns. Finally, supports. If you are just starting 3D printing, you won't use supports much. They are only needed if your model has an overhang. Overhangs aren't common in the models beginners will print, but it is important to know when to use supports for the future. Supports do exactly as you'd think, they support part of a model, in this case, the part with an overhang. Support material is intentionally printed weak so that it is easy to remove after the print. Don't forget, the top of a cylinder that is laying horizontally is also an overhang. Hopefully, these basic tips for 3D printing settings can help you understand the effects of changing them within a slicing program.

Wednesday, July 5, 2017

New Discovery on MOD-t Online Slicer

I previously mentioned that you could only print custom .stl files through the desktop New Matter MOD-t Utility, but, that is incorrect. I recently discovered an upload feature on the online utility. 3D printer utilities can also be called slicers, because they "slice" a model file into layers for the printer to print. On the New Matter website, you can upload a file containing a custom model, thus not limiting you to the New Matter Design Store. You can also change numerous print settings, such as speed, layer height, supports, brim/raft, and more. There aren't as many settings as a dedicated slicing program like Cura, but still enough. This changes my view on the MOD-t a little bit. Before, I felt that its one-click remote printing was held back by the fact that you could only print models from New Matter (or so I thought). Now, I can print any model I want, whether it be from Thingiverse or one that I've created myself. I have been using the MOD-t for the past week and it has never disappointed.