Posts | Comments

Planet Arduino

Archive for the ‘Ardunio’ Category

A traditional early project for someone discovering a love for electronics has been for many years a metal detector. This would mean a few transistors back in the day, but today it’s more likely to involve a microcontroller. [Mircemk] has an example that bends both worlds, with a single transistor oscillator and an Arduino.

This type of metal detector has a large search coil which forms part of the tuned circuit in an oscillator. As a piece of metal enters its range the frequency of oscillation changes. In the old days, this would have been detected as an audible beat frequency with another oscillator. This design would require a calibration step at the start of detecting, to tune the two oscillators to the same frequency.

This detector keeps the first oscillator but eschews the second one in favor of an Arduino. The microcontroller acts as a frequency counter, monitoring the frequency and issuing an alarm when it detects a change likely to be caused by a piece of metal. It may not have some of the finess a human ear could apply to a beat frequency in the all-analogue days, but it’s simple enough to build and it avoids the need for calibration. Seeing it in the video below the break we’re sure that just like those transistor models old, there will be plenty of fun to be had with it.

An Arduino may be one of the current go-to parts, but will it ever displace the 555? Perhaps not in the world of metal detectors!

A traditional early project for someone discovering a love for electronics has been for many years a metal detector. This would mean a few transistors back in the day, but today it’s more likely to involve a microcontroller. [Mircemk] has an example that bends both worlds, with a single transistor oscillator and an Arduino.

This type of metal detector has a large search coil which forms part of the tuned circuit in an oscillator. As a piece of metal enters its range the frequency of oscillation changes. In the old days, this would have been detected as an audible beat frequency with another oscillator. This design would require a calibration step at the start of detecting, to tune the two oscillators to the same frequency.

This detector keeps the first oscillator but eschews the second one in favor of an Arduino. The microcontroller acts as a frequency counter, monitoring the frequency and issuing an alarm when it detects a change likely to be caused by a piece of metal. It may not have some of the finess a human ear could apply to a beat frequency in the all-analogue days, but it’s simple enough to build and it avoids the need for calibration. Seeing it in the video below the break we’re sure that just like those transistor models old, there will be plenty of fun to be had with it.

An Arduino may be one of the current go-to parts, but will it ever displace the 555? Perhaps not in the world of metal detectors!

It wasn’t too long ago that one could conjecture that most hackers are not avid video game players. We spend most of our free time taking things apart, tinkering with microcontrollers and reading the latest [Jenny List] article on Hackaday.com. When we do think of video games, our neurons generally fire in the direction of emulating a console on a single board computer, such as a Raspberry Pi or a Beaglebone. Or even emulating the actual console processor on an FPGA. Rarely do we venture off into 3D programs meant to make modern video games. If we can’t export an .STL with it, we’re not interested. It’s just not our bag.

Oculus Rift changed this. The VR headset was originally invented for 3D video games, but quickly became a darling to hackers the world over. Virtual Reality technology is far bigger than just video games, and brings opportunity to many fields such as real estate, construction, product visualization, education, social interaction… the list goes on and on.

The Oculus team got together with the folks over at Unity in the early days to make it easy for video game makers to make content for the Rift. Unity is a game engine designed with a shallow learning curve and is available for free for non-commercial use. The Oculus Rift can be integrated into a Unity environment with the check of a setting and importing a small package, available on the Oculus site. This makes it easy for anyone interested in VR technology to get a Rift and start pumping out content.

Hackers have taken things a step further and have written scripts that allow Unity to communicate with an Arduino. VR is fun. But VR plus physical reality is just down right exciting! In this article, we’re going to walk you through setting up your Oculus Rift and Unity game engine to communicate with the outside world via an Arduino.

Off the Shelf Options

If you head over to the Unity Asset page and run a search for Arduino, you get a few options. Sadly, searches for Raspberry Pi do not yield any fruit. There are a few generic serial communication options such as Simple Serial and SD Serial, but these options are not free and do not, at face value, appear to be well supported. Unidino looks promising, but it’s thirty bucks and there’s not much activity on the forum. The obvious choice to play around with on a rainy day is ARDunity. There’s a free version that still has plenty of capability to experiment with, and it’s well supported and documented.  It’s written in more of a WYSIWYG style that can be off-putting to coders, but it will have to suffice until someone bangs out more advanced version.

Getting Started

We’re assuming that you already have Arduino and Oculus setup on your PC. If you don’t have an Oculus Rift, we recommend to go to the Oculus site and install the software anyway. It will allow you to test the Unity/Arduino communication through the Oculus run-time even if you don’t have the hardware. This way when you do get a headset, you won’t have to do anything. Just execute the .exe and you’ll see your work in VR. Note that they used to prevent the software from installing on computers that did not meet the minimum requirements. Oculus has since toned down this nuisance, and now allows the software to be installed on most computers, including laptops!

Setting up Unity is straight forward – simply go to the site and download the installer. The latest version at the time of this article is 5.6.1. You’ll want to grab the personal version – it’s about five Gigabytes, so give it some time to download. Once installed, head over to the Oculus site and grab the Unity tools import package.

Open Unity and open a new project. Then head back to the Unity Asset store and install the ARDunity Basic Import package.  This will open Unity, and you should see a tab called Asset Store. Click on the tab and then import the package. Then go to Edit–>Project Settings–>Player and set the API compatibility level to .NET 2.0. This will clear the error you see in the bottom of the screen. Then under Other Settings, be sure to select the Virtual Reality Supported option.

Now import the Oculus package by going to Asset–>Import Package–>Custom Package and point towards the Oculus package you downloaded earlier. Restart the Unity program if needed.

Putting It All Together

At this point, everything should be set to get Unity talking to your Arduino through the Oculus Rift. Put an LED on D2 and note your comm port.  From the Project tab (lower left),  expand the folders ARDunity–>Examples–>LED–>Digital. Double click the last example – ReactingTrigger(DigitalLED).unity.

That will load the example. You should now see two cubes in the view window, and a new folder called ARDunity under the hierarchy tab on the top left. Click on ARDunity and you’ll see the inspector tab (far right) change to include a button that says “Export Sketch”. Hit the button and it will export the Arduino sketch to a place of

View of scene after opening LED example

your choosing. The .ccp and .h files will be generated automatically, along with some other dependencies. I shouldn’t have to tell you to have a look around, but don’t forget to compile and upload it after you’ve had your fill.

Just below the Export Sketch button will be the Comm Serial (Script) window. Search for and select the comm port for you Arduino. After you find your comm port, hit the little play button on top of the main scene window. Once you do this, you’ll see a “Connect” button appear where the Export Sketch was. Go ahead and connect. Now click on the Scene tab above the main viewing window. This will allow you to manipulate the cubes. Go ahead and grab the white cube and run it into the green one. If you did everything right, you’ll see your LED light when the two cubes collide.

The gears in your noggin should be turning right about now… if you can toggle IO from within a game engine; there is some seriously cool stuff you can do! But we’ve only scratched the surface. Let’s get this working in Virtual Reality!

Enter the Rift

In order to enter the virtual world, you need a couple of things. One is a character controller and the other is something to walk on. Hit the play button again if you haven’t already. This will disconnect everything and allow you to edit the world. Go to Game Object–>3D Object–>Plane and adjust the plane so the two cubes are hovering above it. Then un-collapse the ARDuino and expand the OVR folder to OVR–>Prefabs. Select the OVRPlayerController.prefab and drag it into the main hierarchy in the upper left. You’ll see the player controller appear in the main scene window. Drag it away from the cubes, and then under the inspector tab on the right hand side, de-select the Use Profile Data option in the OVR Player Controller (Script) section.

Now, select ARDuino under the hierarchy tab, press play and then connect. If you have an Oculus Rift connected, you should be able to put it on and run into the green cube and light the LED on the Arduino. If you don’t have one, just use the arrow keys to do the same.

Conclusion

So where can you go with this? The biggest thing that jumps out to us is haptic feedback. Imagine instead of a cube, you have a wall or table or something of that nature. Have the Arduino trigger some type of feedback when you touch or bump into the object.

Dig into the code and let us know of any bugs or improvements. Be sure to follow some other examples as well, and check out the video below for a demonstration. If you’ve done anything cool with Unity, show us in the comments.

 


Filed under: Arduino Hacks, Featured, Interest, Virtual Reality

You could sometimes be forgiven for thinking that making popular music has become too easy. With a laptop and suitable software almost anybody can now assemble something that had they secured the services of a canny promoter would be in with a shot at stardom. So many performances have been reduced to tightly choreographed dance acts to mask the absence of musicians or indeed musical talent, and our culture is poorer for it. It’s not that music made with modern technology or outside the performance is an indicator of lack of talent, indeed when a truly talented musician makes something with the resources of a modern technology the results are astounding. Instead it perhaps seems as though the technology is cheapened by an association with mediocrity when it should be a tool of greatness.

So it was with pleasure that we noticed a fresh project on Hackaday.io this morning which provides a marriage of accessible music technology and a requirement for performance. [Ernest Warzocha] has made a wooden sequencer.

It’s true, audio sequencers are old hat, so a new one will have to work hard to enthuse a seasoned Hackaday reader who’s seen it all. What makes [Ernest’s] sequencer different is that he’s made one with a very physical interface of wooden pucks placed in circular recesses on a wooden surface. Each recess has an infra-red reflective sensor that detects the surface texture of the puck placed in it and varies the sample it plays accordingly. It’s all held together underneath by an Arduino, and MP3 samples are played by a Sparkfun MP3 shield. At a stroke, he has turned the humble sequencer from a workaday studio tool into a performance art form that you can see in the video below, and we like that.

Home made sequencers have a special place in maker culture, and as you might expect over the years we’ve featured quite a few of them. Shift registers, CMOS analogue switches or even turntables as the sequencer elements, Lego as a human interface, a sequencer made from a cash register, and a rather lovely steampunk sequencer, to name but a few. So this one joins a rich tradition, and we look forward to more in the future.


Filed under: Arduino Hacks, musical hacks
Lug
19

DIY laser cut word clock.

What is a word clock? A word clock is a clock that displays the time typographically that is also an interactive piece of art. Rather than buy one for $1500, [Buckeyeguy89] decided to build one as a present for his older brother. A very nice present indeed!

There are many different things that come into play when designing a word clock. The front panel is made from a laser cut piece of birch using the service from Ponoko. Additionally, white translucent pieces of acrylic were needed to keep each word’s light from bleeding into the neighboring letters. The hardware uses two Arduinos to control the LEDs and a DS3231 RTC for keeping accurate time. The results are very impressive, but it would sure make assembly easier if a custom PCB was used in the final version. For a one-off project, this makes a great birthday present.

The craftsmanship of this word clock is great, making it well suited for any home. What projects have you built that involve more than just electronics? Sometimes, quality aesthetics make all the difference.


Filed under: Arduino Hacks, clock 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.

  • Like Us on Facebook