HC-RS04 NewPing Class


sonar non blocking sonar

Just finished writing a small C++ class to work with multiple HC-RS04 sonar transducers with a non-blocking way with the NewPing Library.
In this exact code I connected two sensors, but you can add as many as you like.

To add new sonars, just create a new instance of it adding the echo and trigger pins.

Sonar sonar1(2,3);

Here is an example with some NeoPixels, just for fun:

Cheers!

Interfacing two Adafruit MMA8451 via I2C

This week I had to interface two accelerometers (adafruit MMA8451 breakout boards) into one Arduino board.

On Adafruits website, they write that you can address the sensors with 0x1C by adding a pull-down resistor on the “A” pin, or 0x1D by connecting the
“3Vo” to a 3V3 source. What they don’t tell is how to use them both at the same time, which gets clear once you take a look at the Adafruit_MMA8451 class within the library file Adafruit_MMA8451.h.

bool begin(uint8_t addr = MMA8451_DEFAULT_ADDRESS);

metronome

Here you have a simple code based on the library example, but adding the two sensors:

Arduino Crash Course: Get up and running in 1 hour

Have you heard of the Arduino? Its a small but powerful micro-controller that can be used to create many amazing things. An Arduino can be used to sense its own environment, connect and communicate with the Internet, manipulate devices around it, send messages, and much much more. Last year, over 700,000 hobbyists were using and contributing to the Arduino environment.

This course is designed to take you from 0 to 100 with Arduino in less than an hour. At the end of the course, you’ll be fully familiarized with Arduino and ready to build your own applications and devices. Ideally, this course is for beginners who want to get their toes wet with the Arduino system but those already familiar with Arduino can still learn from the techniques used in this course.

What you’ll learn in this course:

– How to setup the Arduino software and start outputting code
– How to understand and write code that your Arduino can understand
– How to setup Serial communication
– How to use a breadboard, and RGB sensor, and a LED Pin.
– How to create a variety of functions that interact with your Arduino
– How to create a device that detects your rooms temperature and changes colors accordingly.

ALL IN LESS THAN ONE HOUR!

Continue reading

AD5204 Digital Potentiometer Breakout Board

board-pic

The AD5204 is a Digital Potentiometer with four internal 10kΩ, 50kΩ or 100kΩ potentiometers. It’s a 8 bits chip which means it has 2^8 = 256 steps from 0Ω to 100kΩ. It can be easily controlled by any microcontroller as it uses a Serial Peripheral Interface Bus (SPI).

I was working on a project where I needed to use some of those AD5204, so I developed a tiny breakout board in order to be able to prototype it using a SMD chip on the breadboard.

Now I’m sharing the Eagle Cad files, so whenever you need to use this chip, you can make some breakout boards with OSH PARK and use it with your projects.

Below you can find an Arduino code example along with useful links.
Hope this can be useful for you!

Any question just let me know!

Continue reading

Living in Italy

Hi there guys! Long time no see!

Well, since last September I’ve been living in Italy, I guess that’s the reason why I haven’t updated the website in a while, but I will make up to you, good things to come!!!

I moved to Milan on 16th of September 2011 for a “Erasmus” Program (it’s a exchange program, but here, saying Erasmus is easy to make people understand) at the Politecnico di Milano, which is one of the biggest universities in the fields of Engineering of Italy.

Continue reading

Dotklok + LM35 Temperature Sensor

I got my Dotklok up and running some days ago, I am really enjoying it on my room.
But I want to do more with it. Too bad right now I don’t have much time to play with electronics and build cool things.

Anyway, today I decided to spend some time learning the Dotklok’s code and add a temperature sensor to it. The result was really cool, and now I am sharing the bit of code I added to the clock.
Continue reading

Arduino + Sound Sensor

I got a sound sensor on Ebay some days ago, and decided to give it a try!
Really simple, just made a code to light up the led when the volume was higher than the ambient sound.

Just for fun! 😉

As many people have asked, here goes the code:

Remember that there are many other ways of doing this, for example using the PWM function along with analogRead() and map().