bookmark_borderHC-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!

bookmark_borderQuickly sharing 360 pictures

Last black friday I got a LG 360 Cam, a good cost-quality 360 camera. The only problem I am having with the camera is that there isn’t a good solution to where I can share the pictures (if you have a good solution, please share!). Google has released a VrView script that makes it much easier to embed 360 pictures on websites, but you still need to edit some html code.

I decided to make a super simple website that renders pictures uploaded to imgur (saving some space and bandwidth on my server) that anyone can use to easily share 360 pictures with family and friends.

After understanding how the Googles VrVire works, I could transform this:

Into this:

To share the 360 pictures, you need to upload them to www.imgur.com and get the picture-id. For example, the picture above is located at https://imgur.com/up6aRXr where up6aRXr is the picture-id. With the id in hands, you can share this url:

https://www.danielandrade.net/360/PHOTO-ID

for the past example:

https://www.danielandrade.net/360/up6aRXr

The website should open with the image showing in full-page, and same URL you can share on Whatsapp or anywhere else (it is mobile friendly!)

Maybe in a near future I will improve it, making it easier to share from within the phone and also creating galleries, what do you think? Ideas?

Cheers! đŸ™‚

bookmark_borderNeoPixel 24 & HC-RS04 Sonar Support


sonar neopixel 01

I am currently working on a project that involve using a HC-SR04 Sonar sensor to control the lights of a Adafruit NeoPixel 24 Leds Ring. Yesterday I quickly designed a 3D model with DesignSpark Mechanical that I am using to center the sensor inside the led ring. I have also added a few spaces where the cable can pass though without disturbing the flat surface.

You can download it from GitHub, and there will probably be updates on the design in a near future.

What do you think?

Check this cool 3D preview by GitHub:

Continue reading “NeoPixel 24 & HC-RS04 Sonar Support”

bookmark_borderAltium Tip: Smooth edges with Teardrops

Teardrops is a really nice feature present in Altium, where it analyzes all the traces and try to smoothen the edges of the connections. Most users don’t know that this feature exists, and even if doesn’t add a major change on the design it can certainly improve the quality of your project, especially if you are working on high-speed or high-power electronics.

altium teardrops

To access the menu, while editing your PCB, go to Tools >> Teardrops… (or simply press t + e).

Bellow you can check a random PCB design with and without Teardrops:

altium teardrops before

altium teardrops after

bookmark_borderInterfacing 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: