With the sort of tinkering I get up to, it is often useful to have a small amplifier on hand. Couldn't resist when I saw this little kit on sale for $10. It requires just a little soldering (34 connections in all) and it is recommended for this project that you insert a pointed tip into your soldering iron. We will be soldering components onto a PCB so it is important to do a neat job with the soldering iron being careful not to short-circuit two pins by using too much solder. The amp consists of a PCB, an IC, five capacitors, a diode and some terminal pins. Beginning with the IC, the components are added one-by-one to the PCB and soldered into place. The IC is soldered directly to the PCB and does not require the use of an IC socket. Care should be taken not to use too much solder as the terminals are very close together and we don't want any short-circuits. The amp consumer a maximum of 3W of power with corresponds to 500mA at 6V and will accept an input voltage of 6VDC to 15VDC. I found an old 9V DC power supply supply that delivers 600mA which should be perfect for the job. I cut the plug off this and soldered it to the power terminals of the amplifier making sure not to cross the positive and negative wires (a cheap multimeter can help with this).
Soldering the components
For the purpose of testing the amplifier, I used the same paper plate speaker that I built in a previous project (actually I had to rebuild the speaker because the old one was looking a little worse for wear). This allowed for a direct comparison of the speaker performance first without and then with the added 3W amplifier. Since this is a mono amplifier and because we have only one speaker, when connecting the 3.5mm stereo jack to the input terminals of the amplifier, the left and right channels were first twisted together. The use of crocodile clips makes it quick and easy to connect the speaker and the audio source to the amplifier. The insulation on the wires can be easily removed by using a lighter to burn the tips. I must say, I'm pretty impressed with the results. The amplifier gave the speaker performance a dramatic boost. In fact so much so that turning the volume up too much caused the speaker the reverberate to the point of distortion. To be fair, it should also be mentioned that, when hooked up to a proper (higher quality) speaker, the amplifier delivered a clear, crisp sound (substantially better than that of the paper plate speaker - as you might expect) and good volume. This is a very handy amp that can be used for a whole array of applications and at a (marked down) $10 price point at my nearby Radio Shack, I bought a whole bunch of them - can't go wrong! Additionally, this project provides a good, quick exercise to brush up of your soldering skills. This whole project should take no more than 30 minutes from start to finish.
We would like to build a input device for our computer that allows the user to use hand gestures in order to command a computer program. We begin by experimenting with a ultrasonic distance sensor in order to better understand its operating characteristics. The ultrasonic sensor will form the basis for a measuring device that will be used to locate the user's hand in 3D space. Most Arduino projects that require the use of an ultrasonic sensor will generally point you in the direction of Parallax's Ping Ultrasonic Sensor. These sensors tend to be pricey (about $25 to $30) and so I searched for a cheap replacement. In the end, I found a HC-SR04 Ranging Detector by SainSmart these are available for $2 to $5 at Amazon.com. So way, way, cheaper, but the real question is how well do they work? One point to note is that while the Ping sensor has three connections (Vcc, SIG, GND), the HC-SR04
requires four connections (Vcc, Trig, Echo, GND). This requires just a slight modification of the example sketch for the Ping sensor from the Arduino IDE, viz. that separate pins are now to be used for the triggering and the reading of the sensor rather than using one pin that was switched between being used for OUTPUT versus INPUT. Additionally, I abstracted the reading of a distance measurement by creating a function called getData(trigPin, echoPin) which facilitates easy reuse of the code for the reading of multiple sensors. Distance measurements are returned in centimeters only.
Wiring Setup for HC-SR04
So, in order to get started, we build a simple sensor by connecting an Arduino Nano to a three ultrasonic sensors and run a simple sketch to log the sensor data by outputting it to the serial port. We use three sensors so that we can test for the consistency and variations of each sensor thereby allowing us to determine the accuracy of the HC-SR04 ranging sensor.
For certain applications, the speed Arduino's embedded microprocessor might be a little underpowered. Owing to the low cost of the Arduino, it allows us to add Arduinos processors to various parts of the system to allow for parallel processing. Such a setup is achievable using the standard I²C bus. According to Wikipedia:
I²C (Inter-Integrated Circuit, referred to as I-squared-C, I-two-C, or IIC) is a multimaster serial single-ended computer bus invented by Philips used for attaching low-speed peripherals to a motherboard, embedded system, cellphone, or other electronic device.
Arduino Nano v3.0 Pin Layout
One thing to note is that, in general, when connecting any devices using the I²C bus, a pull-up resistor should be used. In the case of connecting an Arduino, however, this is unnecessary as the Arduino has the pull-up resistor built in to its circuitry. The concept is demonstrated using three Arduino Nanos which I picked up for $10 a piece (can't beat that!). In the case of the Arduino Uno and Nano (and most, but not all, of the others) the I²C interface makes using of analog pins 4 and 5 which are used for the serial data (SDA) and serial clock (SCL) lines respectively.
Breadboard Layout
We proceed by placing three Arduino Nanos on a breadboard as shown in the diagram. Because there is limited space on the breadboard, when the Nanos are inserted, the USB ports on two of the Nanos cannot be accessed. These two nanos will be designated the slave devices and will communicate data to the master device (the Nanos which does have an accessible USB port). This port will be connected to a USB port on my laptop to provide power to the Nano and also to allow for monitoring of the master Nano's serial port. The two slave Nanos will receive their power from the master Nano. In order to provide power to the slaves devices, the 5V+ and GND pins on the master is used to provide power and ground to the side rails on the breadboard to which the Vin and GND pins respectively of the slave devices are connected. In order to provide the I²C interface connectivity, pin 4 on each of the Arduinos are connected together (white wire) and similarly pin 5 of each are connected (yellow wire).
Three Nanos communicating via I²C.
All that remains is to upload the appropriate sketch to each Arduino and connect the USB cable to the master. The sketches used are very simple and intended simply to demonstrate the ability to network together multiple Arduinos in order to allow for distributed parallel processing. In order to use the I²C interface for communication of data, the Wire library provides the needed functionality. The sketch we use is based upon the sample code given in the Arduino IDE, but has been altered somewhat to extend it to multiple slave devices. A copy of the source code is available here.
The Nano in the middle of the breadboard is removed temporarily, connected to the laptop via USB has has the sketch slave_sender1 uploaded to it. Similarly, the second slave device is connected to the laptop and sketch slave_sender2 is uploaded to it. The USB cable is removed and the slave is replaced onto the breadboard taking care to replace it into the exact location from where it was removed.
Serial Port Monitor
Finally, the USB cable is connected to the master device and the sketch master_reader is uploaded to it. If everything is working correctly, the two slave devices (which are ostensibly to be used as sensors) should each be assigned an address and should then report data to the master when asked. In this case, each slave device will simply send its name ("Sensor1" or "Sensor 2" respectively) to the master device upon the master's request for data. The code running on the master device simply sets up a loop that asks each of the slave devices in turn (by address) to send some data (9 bytes) to which the slave device will respond "Sensor 1" or "Sensor 2". The master device then outputs the data it receives to the serial port. If all is working correctly, then monitoring the serial port on the master device should show this.
Total Mass: 1.5kg, Expected Thrust: 1.2kg x 4 = 4.8kg Cost: $220
Other Parts:
Transmitter: my trusty Spektrum DX7
Receiver: Spektrum AR6100e
Miscellaneous: soldering iron, solder (rosin core), power and ground electrical cable (12-gauge, about 6 inches of each), heat shrink insulation, velcro straps, cable ties
Choice of Parts
DJI Flame Wheel F450 Frame
After reviewing many articles on the subject, I elected to go with a quadcopter setup using the DJI F450 frame. This provides a cost-effective setup for a first time project like this while also providing a decent amount of space on which to mount equipment plus sufficient payload-carrying capability PLUS, most importantly, there is a ready supply of spare/replacement parts available. Additionally, DJI provides an ingenious integrated power distribution system embedded in the metal hubs which saves space and facilitates ease of setup. While DJI offers a so-called "ARF" kit (which sans a battery, receiver and flight controller can hardly be described as ARF) which combines, in one box, the frame, motors, ESC's and propellers, I opted to select the various components based on my requirements of wanting ample lifting power, low weight at a low price.
NTM Prop Drive 28-30S 800kv
The prop drive 28-30S 800kv provide incredible amounts of torque for such a small motor. At just $16 each and weighing in at just 65g, these motors when equipped with a 10x4.5 slow flyer prop, should produce approximately 1.2kg of thrust! We selected a very big 4s Turnigy 4000mAh battery (for an unbelievably low price of $32!). This weighs in at a whopping 437g and contributes approximately one-third of the takeoff weight and was selected in an attempt to allow the vehicle endurance time of, at least, 15 minutes.
HobbyKing KK2 Flight Controller
For the flight controller, a HobbyKing KK2.1 was selected - this is the latest version of the flight controller designed by legend, Rolf Bakke. While this flight controller does not include some of the high-end features found of the expensive controllers, it contains more than enough features for now and at a price of only $30, is a great to get in the game. Eventually, I expect to replace this with a fancy controller (like the NAZA flight controller which can run $200 or more depending on the features needed), but before spending the money, I prefer to know exactly which additional feature I would like.
Assembly
Assembly begins by attaching a female Deans ultra plug to the battery and creating matching pigtail using the male Deans ultra plug and some short pieces of 12-gauge wire for each the power and ground connections (or alternatively buy a prefabricated pigtail with a male plug). Be careful not to cross-wire this; connect the male and female plugs to verify this. Then solder the pigtail connection to the appropriate terminals of the power distribution board (PDB) on the hub by soldering the red wire to positive '+' and the black wire to negative '-'.
Next, the ESC's are prepared by soldering three female bullet connectors to each of the three (black) wires that will attach the ESC to a motor. Once complete, the arms are attached to the hub (with the white arms at the front and the red arms at the back), the motors mounted to the arms using the screws provided with the flame wheel kit, an ESC is attached to each arm using cable ties and connected to that motor using the bullet connectors. At this time the positive and ground wires coming off the ESC can each be trimmed to length and soldered to the appropriate terminal points on the PDB. For future reference, the side of the quadcopter containing the white arms is designated to be the front and the side with the red arms is the back. This orientation will be maintained for the rest of the assembly and beyond. The use of the red and white arms will further all us to identify the direction that the quadcopter is pointing when it is far away.
At this stage, the assembly is just about complete. All that remains is to add the receiver and the flight controller and wiring it all together (receiver connects to the left side and motors connect to the right side of the KK2 board. The receiver was mounted, using double-sided tape, to one of the side panels (the other will be used for the GPS and FPV equipment. In order to mount the flight controller, I simply used the foam padding container that it was shipped in by hot gluing the controller board to the padding and gluing the padding to the mounting plate on the hub. Using the padding provides the dual benefit of both protecting the flight controller from damage (in the event of a rough landing) as well as reducing the transmissions of vibrations from the frame to the flight controller. Testing of the receiver and the KK2 flight controller can be now be conducted in order to verify that all is working correctly. It should be noted that the KK2 gets its power via the ESC on motor 1. Unless motor 1 is connected (and the battery is attached to the PDB), the flight controller will receiver no power. Once testing of the KK2 is complete and satisfactory, the top plate of the hub can be attached.
Before attaching the propellers, it is necessary to ensure that each of the motors is rotating in the correct direction. Each motor is given an identifying number starting with the front left motor which is assigned the number 1 and then continuing from with the front right and then proceeding in a clockwise fashion. It is essential for effective yaw control that diagonally opposite motors spin n the same direction. By convention, motors 1 & 3 should spin clockwise while motors 2 & 4 should spin counterclockwise. In order to spin the motors, we must first arm the KK2. This is achieved by using the left stick in the transmitter and moving it down (zero throttle) and to the right. Holding it there for a couple of seconds will arm the KK2 and increasing the throttle stick will now cause the motors to spin. It should be very quick and easy to verify the direction of rotation of each of the motors. The direction of rotation on any motor can be easily reversed by disconnecting two of the wires between the ESC and the motor and switching them (yes, you can switch ANY two wires, it does not matter which to and the motor will reverse - this characteristic of a stepper motor).
At this point we are ready to mount the propellers and begin tuning the flight controller. We want to ensure that the gyros are zeroed out on a level surface and will then go about messing with the P and I gains on the controller to ensure that the self-leveling mode is stabilizing the quadcopter's flight. This will be useful for FPV flying and aerial photography while reducing the overall agility of the vehicle. Here is some video of the quad spinning up for the for time and performing its very first aerial test. The goal here is to tune the controller.
DISCLAIMER: THESE MAGNETS ARE NOT TOYS! They are extremely
strong and can cause pinching of fingers between them and magnetic
surfaces if not careful. Additionally, they are very brittle and tend
to chip easily, if impacted, leaving sharp edges and can cut fingers. DO NOT TAKE THESE NEAR ANYONE WITH A PACEMAKER! And obviously do not leave them lying around.
3.5mm Plug
A mini stereo jack (3.5mm plug) is the common headphone jack that fits one's smart phone or standard MP3 players. Most often, this can be salvaged from an old, broken headset. This will be used to hook it up to an MP3 player. If you will be running your music through an amplifier then you can connect the speaker directly to the speaker port on the amp.
30-Gauge Copper Wire
Thin copper wire should be used. The thickness of the wire is given by
the gauge and the higher the gauge, the thinner the wire. For this project, 30-gauge wire is recommended. It is not
recommended to use wire thicker than 26-gauge. This project requires at
least 30 feet of wire in order to make the voice coil for the speaker.
Wrapped Magnet
Building the Voice Coil
From a regular sheet of paper, cut two similar strips. Each should have a width of about 2 inches. Wrap one of the strips around the magnet forming a cylinder. Use a piece of sticky tape to hold the paper cylinder together. This first strip is to be used as a spacer between the magnet and the voice coil, SO you want to make sure that it it has a little thickness to it. Paper should wrap around the magnet a few times - it is not necessary to trim to size. This will be used as a form about which we will build the voice coil.
Forming the Voice Coil
We form the voice coil by wrapping the 2nd strip of paper around the
wrapped magnet. A couple of things to note here. The 2nd strip of
paper should be trimmed in length to ensure about only 1/2 inch of
overlap (unlike the 1st strip of paper which was wrapped several times
around the magnet). The 2nd strip should not wrapped too tightly around the wrapped magnet. We want to ensure that the inner diameter of the voice coil is somewhat larger than the diameter of the magnet.
Winding the Wire
The copper wire is then wound around the 2nd strip of paper. The more
coils, the louder the speaker will be. In forming the voice coil for
this project, we used 70 winds of the wire. When winding the wire, care
should be taken to keep the winding near the middle of the 2nd strip of
paper. Winding should be dense so you should move back-and-forth when
winding in order to create overlapping coils. The copper wire is
insulated so this is fine. This is where the thinner gauge wires will
allow for more dense windings of the coils.
Removing the Form
Once the winding is complete, hot glue is used to keep the wire in place. A touch of glue was also added to the seam of the paper. Upon allowing the glue to cool, the voice coil was born. Very carefully, the magnet and then the first strip of paper is removed from inside the voice coil. It is important to do this without squishing or bending the voice coil. What remains is the voice coil which is the 2nd strip of paper with the copper wire wrapped around it and hot glued.
The Voice Coil
The voice coil is trimmed to a total length (height) of about 1.25 inches. The result is a neat and even paper cylinder. If there is too much overlap, this will create excess paper that tends to clog the inside of the cylinder. This must be trimmed without deforming the paper cylinder and can be done using nail scissors. We are now ready to assemble the speaker.
Magnet Mounted on Base Plate
Speaker Assembly
One of the paper plates is placed face down on the table which will be used as the base of the speaker. The magnet is hot glued to the back of the plate in the center of the plate (this does not need to be exact - just a best guesstimate).
Voice Coil Mounted on Diaphragm
A second paper plate will be used as the diaphragm. This is the part of the speaker that moves. In order to make it move, the voice coil must be attached. In order to mark the correct placement for the voice coil, the voice coil is placed over the magnet and the the plates are placed back-back-back and the position marked on the diaphragm where the voice coil will be attached. The voice coil is then attached to the diaphragm using hot glue making sure not to clog the center of the voice coil. The voice coil must be able to slide over the magnet unobstructed.
Cardboard Springs are Added
The third paper plate is for parts. Cut out the center part of the third paper plate and from this cut two strips each of width 1 inch and length 6 inches. The strips are folded back-and-forth to create pleats. These will be used as cardboard springs to support the diaphragm while allow it to vibrate. The springs are hot glued to the back of the diaphragm on opposite edges with the voice coil in between as shown in the picture.
Removing the Insulation
Before attaching the diaphragm to the base, the last thing to do is to remove a section of insulation at each of the ends of the copper wire. This is easily achieved by simply using a lighter and burning off the insulation. The insulation burns quite readily so be ready to blow it out when enough has burnt away.
Positioning the Diaphragm
The diaphragm is placed in position over the base plate. The cardboard springs are trimmed to the correct length to ensure that the voice coil is positioned directly over the magnet and passes over the magnet unobstructed as the diaphragm is pressed down slightly. The diaphragm should be raised high enough above the base plate so that the bottom of the voice coil never touches the base plate. The diaphragm is attached to the base plate by gluing the feet of the cardboard springs to the base plate.
The Completed Speaker
The assembly is completed by bending and adjusting the springs slightly to ensure correct positioning and movement of the diaphragm on the base plate. And that's it!
All that remains is to attach the ends of the copper wire to the mini jack (3.5mm plug) and plug it in to an MP3 player and to listen to those sweet sounds.