Posts | Comments

Planet Arduino

Numbers are wonderful things when applied to technical specifications. Take [Bobricius]’ handheld Arduino-based game console. With an 8×8 LED matrix for a display it’s not going to win any prizes, but while he’s pushing the boundaries of dubious specification claims he’s not strictly telling any lies with his tongue-in-cheek statement that the graphics are 64-bit.

Jokes aside, it’s a neatly done build using a DIP version of the Arduino MCU and all through-hole components on a custom PCB. Power comes from a CR2032 cell, and it includes three buttons and a small piezoelectric speaker. He’s implemented a whole slew of games, including clones of Pong, Breakout, and Tetris, and judging by the video below it’s surprisingly playable.

Now you might look at this console and wonder what the big deal is. After all, there are plenty of similar designs to be found, and it’s nothing new. Of course, it’s a neat project for any hacker or maker, but we can see that this would make a great starter project for the younger person in your life who wants to try their hands at building something electronic. All through-hole construction for easy soldering, and a neat game at the end of it all.

He’s posted a full write-up of the design process as well as the hackaday.io page linked above, so if you fancy building one yourself there’s nothing to stop you too squeezing 64 bits of graphical goodness from an Arduino.

This isn’t the first Arduino game we’ve shown you here at Hackaday, we’ve unmasked the secrets of the Arduinocade, featured another handheld Arduino game with an LCD screen, and a beautifully coded console using a TFT among many more.


Filed under: Arduino Hacks

As part of their final project at EDN – Navàs, robotics students Rafart Jordi and Marc Thomas recently built an impressive Arduino simulator that captures video from a camera-equipped RC vehicle and displays it on a TV screen, making it feel as though you’re in the driver’s seat of a shrunken-down car.

The simulator is driven by an Arduino Uno along with an IBT-2 H-Bridge to control the 24V motors, and wirelessly communicates with the modified toy car via an XBee module.

You have to see it in action below!

Last fall, I grabbed a robot arm from Robot Geeks when they were on sale at Thanksgiving. The arm uses servos to rotate the base and move the joints and gripper. These work well enough but I found one aspect of the arm frustrating. When you apply power, the software commands the servos to move to home position. The movement is sufficiently violent it can cause the entire arm to jump.

This jump occurs because there is no position feedback to the Arduino controller leaving it unable to know the positions of the arm’s servos and move them slowly to home. I pondered how to add this feedback using sensors, imposing the limitation that they couldn’t be large or require replacing existing parts. I decided to try adding accelerometers on each arm section.

Accelerometers, being affected by gravity when on a planet, provide an absolute reference because they always report the direction of down. With an accelerometer I can calculate the angle of an arm section with respect to the direction of gravitational acceleration.

Before discussing the accelerometers, take a look at the picture of the arm. An accelerometer would be added to each section of the arm between the controlling servos.

arm flat extended with text

Accelerometers

Gravity tugs everything toward the center of the mass of the Earth. It is a force that creates an acceleration exactly just like what you feel when a vehicle begins to move or stop. The force of gravity creates an acceleration of 1 g which is 9.8 m/s2 or 32.15 ft/s2. An accelerometer measures this force.

Integrated circuit accelerometers are inexpensive and small devices readily usable by hackers. One reason they are inexpensive is the high demand for them in smart phones. These small devices are based on etching mechanical structures within the integrated circuit using a technology called MEMS (Microelectromechanical systems).

One design for a MEMS accelerometer is basically a variable capacitor. One plate is fixed and the other mounted some distance away on a spring suspension. When the device is accelerated the suspended plate moves closer or further away from the fixed plate, changing the capacitance. Another uses piezo-resistive material to measure the stress on an arm caused by acceleration.

one axis measurementA single axis accelerometer measures acceleration in only one direction. If positioned so the direction is up and down it will measure the force of gravity but will not detect horizontal acceleration. When the device is tilted between horizontal and vertical the force of gravity is only partially affecting the measurement. This provides the ability to measure the angle of the device with the direction of gravity. The acceleration felt along the tilted axis, for a tilt angle can be calculated by:

A_{X} = g \sin\left ( \theta \right )

Knowing the output of the accelerometer we can determine the angle by taking the inverse sine, the arc sine, of the output:

\theta = \arcsin \left ( \frac{A_{X}}{g} \right )

If you rotate a single axis device through 360° the output is a sine wave. Start with the device outputting zero and consider that 0°. As it rotates, the output is 1 when the angle is 90° and back to zero at 180°. Continuing the rotation, the output becomes -1 at 270°, or -90°, degrees and back to zero at 360°, or 0°.

Notice on the chart that between -60° and 60° the output is nearly linear. This is the best orientation for measuring inclination. Increases in inclination are not as accurate on the other portions of the curve. Also notice that the same output is generated for 45° and 135° (90° + 45°) creating an ambiguity. With a single axis you cannot determine which of those angles is measured.

angle of inclination dual axis angle of inclination

Putting two accelerometers at a right angle to one another creates a 2-axis device which solves the ambiguity problem. As the device is rotated through 360° the outputs are 90° out of phase, the same relationship as the sine and cosine. By combining the measurements there is a unique solution for every angle throughout 360°. The acceleration due to gravity at each angle is given by:

\frac{A_{X}}{A_{Y}}  = \frac{\sin\left ( \theta \right )}{\cos\left ( \theta \right )} = \tan\left ( \theta \right )

which leads to calculating the angle by:

\theta = \arctan \left ( \frac{A_{X}}{A_{Y}} \right )

Actually, one more step is needed to determine the sign of the angle. This requires examining the sign of the values for the X and Y axis. It isn’t necessary to go into this here because a standard programming function handles this automatically.

The orientation of a quadcopter requires a 3-axis accelerometer. The calculations for the three spherical angles combine all three inputs for their results. You’ll need to study this carefully because the standard trigonometric equations can cause anomalies when the quadcopter flips.

First Pass Solution

Accelerometers are easily obtained and relatively cheap. You can find them mounted on breakout boards with voltage regulators and all the supporting circuits from the usual vendors. They are available for 1 to 3 axis, various amounts of g force, and providing either analog or digital outputs. Analog devices need an analog input for each axis being measured. Digital outputs use I2C or SPI buses for communications. I decided to use analog devices because digital units typically only allow two addresses and the arm needs three devices, one for each section.

The robot arm uses an Arduino board so there are at least 6 analog inputs. The original board was a Robot Geek Geekduino, their version of the Arduino Duemilanove, with 8 analog inputs. Unfortunately, when working with the arm I broke the USB connector so switched to a Uno equivalent having only 6 inputs.

accelerometerMy choice for accelerometer is a 3-axis, ±3 g accelerometer breakout from Adafruit, their ADXL335. It has one analog output for each axis. Since I’m measuring three joints that means three boards which adds up to 9 analog outputs.

ADXL335-fbl

Because of the geometry of the arm, however, I only need 5 inputs for these three joints. The shoulder joint only moves from 0° to 180°. This can be handled by a single axis accelerometer by mounting it to read acceleration of 1 g for 0° and -1g for 180°. That provides a unique output for the necessary angles. The elbow and wrist joints each require two inputs. The third input is not needed because their motion is constrained to moving within the vertical plane of the arm.

Frame of Reference

The next issue is the frame of reference. This is a standard problem in robotics work. Early in a project, a global frame of reference is decided upon. This sets the origin for the coordinate system that the robot will follow and the direction of the three axes, usually specified as X, Y, and Z. For the arm, X is straight forward, Y is to the left, and Z is straight up. The zero point is the base of the shoulder. This also defines a global frame for rotation of the arms limbs with zero degrees also toward the front.
elbow anglesshoulder angles

Sensors and controllers each have their own frame of reference. Any differences among these devices and the global frame need to be resolved in software. The shoulder servo’s frame of reference is 0° at the back of the arm and 180° at the front, a clockwise rotation. This is the reverse of the global frame. The elbow servo worked the opposite with a counter-clockwise rotation putting 180° straight up and 90° straight out when the shoulder was vertical. It is 90° off from the global frame of reference.

Sensors also have their own frame of reference. The Y-axis accelerometer measuring the shoulder orientation worked counter-clockwise. Both axis on the accelerometers measuring the elbow worked in the clock-wise direction. This may seem strange but it’s because of the different mounting orientations of the sensors.

Software

The actual code is straightforward once the frame of references are sorted out. A single axis is read from the analog input and its angle calculated with:

const int shouldery = shoulderAnalogY.read();
float shoulder_angle = degrees(asin(shouldery_value / 100.0));

The read() method scales the raw analog input values so ±1g is represented as ±100. The input to asin() is divided by 100.0 to convert to the actual g value. That suffices for the shoulder angle.

The elbow and wrist angles use values from two axis and the calculation is:

const int elbowx = elbowAnalogX.read();
const int elbowy = elbowAnalogY.read();
float elbow_angle = degrees(atan2(-elbowy, elbowx));

The atan2() function is a special version of the arc tangent calculation. It examines the signs of the input value to determine the quadrant of the angle to set the appropriate sign on its result. The negative sign on the elbowy is needed to set the appropriate quadrant. There’s the frame of reference issue, again.

Wrap Up

Adding the accelerometers solved the startup lurching problem well enough. Whether the accelerometers can be used for other purposes remains to be seen.

The accuracy of the angle measurements is not good. In part this is due to using a device that with a +/- 3 g range to measure 1/3 of the devices range, 1 g. The device outputs 0 to 3.3 volts while the Arduino is sampling for 5 volts, again losing accuracy. This might be improved by using an Arduino based on 3.3 volts. I have a couple Dues on hand so might try them. The Uno also provides for adjusting the reference voltage for analog inputs so setting it to 3.3 volts might help.

The analog values need to be calibrated with some care. Each accelerometer outputs slightly different values. Calibration requires measuring the outputs for 1 and -1 g for each axis, recording the values, and using them to scale the voltage input to acceleration. This calibration is not accurate given the other problems with the analog inputs.

Another problem is the mounting of the accelerometers on the arm’s sections. The alignment of the boards with the sections of the arm is not perfect. When the servo is positioned at 90° the accelerometer doesn’t necessarily sit at 90° with respect to the center of the earth. Of course, the servos are not that precise, either. They do not always arrive at the same position, especially when approaching from different directions. Another goal for this project was to use the accelerometer information to more precisely position the servos.

I guess I have to think about this project a bit more, including deciding what I actually want to accomplish with the arm. But then, just saying you have a robotic arm is a terrific hacking cred.


Filed under: Arduino Hacks, robots hacks

Kids love Minecraft, and a clever educator can leverage that love to teach some very practical skills. The summer class offered by the Children’s Museum in Bozeman Montana would have blown my mind if such a thing existed when we were younger. (Rather than begging one of the dads in my Boy Scout Troop to pirate Visual Studio for me, which was delivered in the form of an alarmingly tall stack of CDs.) The kids in Bozeman get to learn hardware, software, their integration, and all while playing Minecraft.

Minecraft is an immersive universe that has proven to suck in creative minds. It’s the bait that pulls the kids into the summer class but Serialcraft delivers on making the learning just as addictive. This is accomplished by providing students with physical objects that are tied to the Minecraft world in meaningful ways we just haven’t seen before (at least not all at one time). On the surface this adds physical LEDs, toggle switches, potentiometers, and joysticks to the game. But the physical controls invite understanding of the mechanisms themselves, and they’re intertwined in exciting ways, through command blocks and other in-game components that feel intuitive to the students. From their understanding of the game’s mechanics they understand the physical objects and immediately want to experiment with them in the same way they would new blocks in the game.

The thing that makes this magic possible is a Minecraft mod written by [John Allwine], who gave us a demonstration of the integration at Maker Faire Bay Area 2016. The mod allows the user to access the inputs and output of the Arduino, in this case a Pololu A-Star 32U4, from within Minecraft. For the class this is all packaged nicely in the form of a laser cut controller. It has some LEDs, two joysticks, buttons, potentiometers, and a photosensor.

As you can see in the video below the break, it’s really cool. The kids have a great time with it too. For example, [John] showed them how they can attach their unique controller to a piston in the world. Since this piston can be controlled by them alone, they quickly figured out how to make secret safe rooms for their items.

Another troublesome discovery, was that the photo transistor on the controller set the light level in the game world by altering the time of day. Kids would occasionally get up and change the world from day to night, by turning the lights in the room on or off. A feature that has a certain appeal for any Minecraft player, is rigging one of the LEDs on the controller to change brightness depending on proximity to a creeper.

There’s a lot more to the library, which is available on GitHub. The kids (and adults) have a great time learning to link the real world with the world’s most accessible fantasy world creation kit.  Great work [John]!


Filed under: Arduino Hacks

nfcphoneAdding an NFC unlocker to your car allows you to open your vehicle with your phone, or an NFC ring.

Read more on MAKE

The post Use Your Smartphone as Your Car Key with an NFC Lock appeared first on Make: DIY Projects and Ideas for Makers.

If necessity is the mother of invention, then inconvenience is its frustrating co-conspirator. Faced with a finicky dryer that would shut down mid-cycle with a barely audible beep if its load was uneven (leaving a soggy mass of laundry), [the0ry] decided to add the dryer to the Internet of Things so it could send them an email whenever it shut itself down.

After opening a thinger.io account, adding the soon-to-be device, and setting up the email notification process, [the0ry] combined the ESP8266 Development Board, a photosensitive resistor, and a 5V power supply on a mini breadboard. All that was left was to mount it on the dryer and direct the LDR (light-dependent resistor) to the machine’s door lock LED to trigger an email when it turned off — indicating the cycle had finished or terminated prematurely. A little tape ensured the LDR would only be tripped by the desired light source.

If you’re an apartment-dweller have WiFi in the wash area it would be awesome to see a battery-powered version you take with you. But in general this is a great hardware blueprint as many device have status LEDs that can be monitored in a similar way. If you want to keep the server in-house (literally in this case) check out the Minimal MQTT series [Elliot Williams] recently finished up. It uses a Raspberry Pi as the center server and an ESP8266 is one of the limitless examples of hardware that plays nicely with the protocol.

We love seeing hacks like this because not only does it conserve water and energy by reducing instances of rewashing, but it’s also a clever way to extend the life of an appliance and potentially save hundreds of dollars in replacing it. Add this to the bevvy of hacks that add convenience to one’s home — some of which produce delicious results.


Filed under: Arduino Hacks, home hacks

While this recent project may look like something straight out of Simone Giertz’s notebook, it’s actually the brainchild of James Cochrane. The engineer, who admittedly loves building all sorts of crazy machines, has developed an apparatus he calls the IoT Robot People/Pet Affectionator.

As its name would suggest, the Affectionator is an Arduino Nano-driven device that automatically gives his dog T-Bone a pat on the head along with a spoon-fed treat at the touch of an arcade button. That’s not all, though. It even allows the pup to reciprocate by pressing his own button and sending over a token of his appreciation on a fork–which in Cochrane’s case is a gummy worm.

Aside from the Arduino, the Affectionator is equipped with two H-Bridge motor drivers, two geared Pittman motors, and two geared hobby motors.

These days people are more connected with each other, however we are experiencing fewer physical interactions. This device will allow you to provide affection either locally or remotely to your pet without any physical contact. If your pet decides you are also worthy of their affection they can also reciprocate with a pat on the head and a tasty treat.

One day while giving my dog T-Bone a scratch behind the ears I came up with this silly idea. A robot which gives you a pet on the head and feeds you a treat. With the IoT, you can also build two of these and network them across the Internet.

Intrigued? Watch the hilarious idea in action below!

1_img3021-11low

Cosmic Bitcasting is a digital art and science project emerging from the idea of connecting the human body with the cosmos by creating a wearable device with embedded light, sound and vibration that will provide sensory information on the invisible cosmic radiation that surrounds us. This open-source project actually works by detecting secondary muons generated by cosmic rays hitting the Earth’s atmosphere that pass through the body.

Artist Afroditi Psarra and experimental physicist Cécile Lapoire worked together to develop a prototype of the wearable cosmic ray detector during a one-month residency at Etopia in Zaragoza, and is currently on display at the Etopia-Center for Art and Technology in Zaragoza as part of the exhibition REVERBERADAS.

img3553

Cosmic Bitcasting is comprised of an Arduino Lilypad, High Flex 3981 7×1 fach Kupfer blank conductive thread from Karl Grimm, Pure Copper Polyester Taffeta Fabric by Less EMF, white SMD LEDs, a coin cell vibration motor, and an IRL3103 MOSFET with a 100 Ohm resistor to drive the motor.

Intrigued? Take a look at the video below and read the diary of the residency to learn more!

 

600x400_en-1

A big thanks to everyone who already submitted their projects, performances, and workshops for Maker Faire Rome. However, due to such an incredible demand, the Call for Makers deadline has been extended to Thursday, June 30th. That means you have one more week to send your applications to participate in the 4th edition of Europe’s biggest innovation event, held October 14-16, 2016 at Fiera di Roma.

Want to join us in celebrating Maker culture this fall? With more than 100,000 square meters of exhibition space available, the time to submit your project is now!

Prizes and contests
All the projects selected within the Call for Makers are automatically eligible for the following prizes and contests if they match the requirements specified in each regulation.

[Javier] has put in his time playing Final Fantasy X. In the game, there’s a challenge where you have to dodge 200 consecutive lightning strikes by pressing a button at just the right time. [Javier] did this once, but when he bought a new PS Vita handheld, he wanted the reward but couldn’t bear the drudgery of pressing X when the screen lights up 200 times.

4987021466110559532

So he did what anyone would do: hooked up a light-dependent resistor to an Arduino and rubber-banded a servo to press the X button for him. It’s a simple circuit and a beautiful quick hack, all the more so because it probably only took him a half hour or so to whip up. And that’s a half hour better spent than dodging lightning strikes. According to his screen-shot, he didn’t stop at 200 dodges, though. He racked up 1,568 dodges, with a longest streak of 1,066. You can watch a video on his blog and pull the code out of his GitHub.

Why do this? Because that’s what simple computers are for. We hate these silly jumping mini-games with a passion, so we applaud anyone who cheats their way around them. And while not as hilarious as this machine that cheats at Piano Tiles, [Javier]’s hack gets the job done. What other epic video game cheats are we missing?


Filed under: Arduino Hacks, handhelds hacks, playstation hacks


  • Newsletter

    Sign up for the PlanetArduino Newsletter, which delivers the most popular articles via e-mail to your inbox every week. Just fill in the information below and submit.