300x250 AD TOP

Search This Blog

Pages

Featured Post

A Million Times

A while ago someone at work approached me with an idea to build a replica of  " A Million Times " by Humans Since 1982 , while the...

Paling Dilihat

Powered by Blogger.

Feature Label Area

Friday, March 8, 2019

A Million Times

A while ago someone at work approached me with an idea to build a replica of  "A Million Times" by Humans Since 1982, while the project did eventually die off as far as I know, the idea looked very interesting, many clocks, synchronized to display animation, text and time, what can be bad about it? or as the original creator wrote:

"Metaphorically speaking, we liberated the clock from its sole function of measuring and reporting the time by taking the clock hands out of their 'administrative' roles and turning them into dancers." – Humans since 1982

A Million Times at Changi, 2014-2018
While they did not expose much of the design for their work, David Cox, who is the engineer of this project, shared a few hints in his facebook:

Source



From what I could deduce, the project is probably using 2 types of MCUs, one to control each of the motors (such as ATtiny85) and another to control the whole block (ATmega of sort) and then connected via USB to a PC to control the entire assembly.

This article has been collecting links and paragraphs for quite some time (since July 2017!), I've decided to finish it after I've started to learn more about PCB design and actually took it off the breadboard.

Assuming we would like to design our own, my first thought was that I'll need to use pipes, gears, Plexiglas and plenty of patience, just like Cornelius Franz tried:

source
He actually implemented what I thought to make, I've had a single motor with the same driver, I've had to add a step up (since the driver needed a minimum of 8v and used an ATmega328 instead of the STM32F103), I've had to use a a higher voltage than actually needed since the motor would miss steps and the maximum speed wasn't great since I've used AccelStepper which isn't very efficient. I've also thought about using the micro-switches for addressing but i don't think its a good use of available pins, even if used with resistor ladder.

I've thought about the following options for controllers:
- ATmega328 for board MCU, connected to a driver, hall effect sensor and canbus, which can be used without a transceiver on short distances.
- ATmega328 for board MCU, connected to a driver, hall effect sensor and i2c/spi bus
- ATmega32u2/4 for USB connectivity to i2c/spi

My colleague, Allan Schwartz from whatimade.today suggested the i2c route, I had doubts it will work over long distance, but as it turns out there have been uses for i2c over long distances with repeaters (such as PCA9515), I still didn't get around to test the long distance repeater solution, but the datasheet does specify you may not use more than one repeater, but does it also include parallel repeaters?...) Using the i2c as a bus for the entire assembly makes things simpler over communicating with 20 or more USB virtual com ports.

Different layouts, either a PCB per motor or a PCB for 4 motors, which makes things a lot simpler on one hand but won't work if I wanted to add some more visual effects such as addressable Leds.

For drivers, the following options:
- no driver, these motors do not consume too much power (about 20ma VERIFY), so in theory the Arduino can power it, however, when I tried it, the motor produced inconsistent movement for various speeds, I suspect due to the fact I didn't implement micro-stepping in my source code. I did find out that Wojtek Kosak did make it work without any driver, so it might have been my fault it did not work.
- 2 x ULN2003 ($0.2) or DRV8836 ($1.5) (there are many alternatives, just an h-bridge) per motor
- 2 x A3967SLB ($2) per motor
DRV8821 ($4.5), minimum 8v which might complicate things
- L298N ($1) might work
X12.017 stepper driver / VID6606BY8920 /  AX1201728SG ($1), should be able to control 4 motors (or two dual shaft motors) - source, I've tested the AX1201728SG  and it was very stable even in high speeds as long as acceleration control is implemented.

After testing a few drivers, the one that worked best is the AX1201728SG.

And for motors it turns out there are dual shaft stepper motors, the following look pretty promising:
- X40 8798 Stepper Motor ($6.8) - datasheet
- Sonceboz 6407 (27€)
- vid28-05 Stepper Motor
- BKA30D-R5 ($3.8) with a stop, but it turns out the manufacturer already realized that people would like to use them without a stop, so they started manufacturing them without a stop!!

Last but not least is to use a real clock and modify the circuit, the motor is Lavet-type stepping motor and someone made a crazy clock with it, I love it!



All in all, I think Cornelius Franz did a some amazing work, it seems like he's on a good path to have a working replica!


source

I've also found out that Wojtek Kosak Główczewski actually completed a replica, you might want to look at his schematic and his project:

source

Eventually I wanted to build my own, so I went with the parts I could source from Aliexpress as it was available and didn't cost $50 to ship unlike packages from DigiKey or Mouser.

I got a recommendation to check the VID28-05, however it was harder to find, it seems like they are either no longer manufactured or perhaps I didn't look very hard after finding the replica BKA30D-R5, it's also a plus that the manufacturer is on Aliexpress, its a drop in replacement anyway.

source
The original BKA30D-R5 had a hard stop, which should be removed if you want to rotate it 360 degrees


However, the manufacturer took it upon themselves to supply motors without stops!

The vid28 series comes with a thorough datasheet, explaining how to drive the motors, the pinout, measurements and a lot more, if you're planning to use these motors, its definitely worth to read!

I've made a small breadboard with the motor, an arduino and DRV8825 and it kinda worked, I had to jack up the voltage to 12v (outside the specs) so it won't miss any steps and I've even tried the A4988, but it produced a high pitched noise.


So Allan attempted the same thing using shift register (74HC595), from a video he sent me, I saw it was missing some steps and made a-lot of noise, I suspect its due to the lack of micro-stepping.

To zero the hands, I chose a hall effect sensor + 2mm magnets, I've attempted to use the SS49E but it turned out to be not sensitive enough (1.8mV/G), so I'm now attempting to use the SS495 and while its a bit more sensitive (3.3mV/G), its a lot more expensive, so perhaps using a larger magnet or a a sort of magnetic flux concentrator will be a better solution.

It did work properly on one side, I'm not sure if its the N or P, so I'm thinking about building a 3D magnetic sensor (using MLX90393) to diagnose the problem more precisely.

Alternative methods can be to use a reflective optical sensor or a reed switch, but the magnet needed for the reed is too big and heavy to fit on the hands.

I think the research we did on this project makes it relatively simple to implement hardware wise, you may find software other developers wrote in the end of this article. in my opinion,probably the easiest build will be a combination of the original PCB form factor, X12.017 driver, a hall sensor and atmega328p, wire a few assemblies with i2c and to a PC via USB.

I've started to design a more modular PCB, you can shape it into cubes, spheres, towers, what ever your imagination can conjure.


The first revision was a partial success, the motor fits perfectly, the lights work, the homing more or less works.

A few design issues were discovered during the first test, the brownout trips when either the leds turn on or the motor driver resets, and although I covered most of the power requirements by adjusting the trace widths, you can guess what the problem was, decoupling capacitors for example and a main capacitor.

I've also used relatively heavy acrylic hands with magnets on them, so the motors missed steps here and there, I've rewrote AccelStepper to use interrupts and s-curve instead of linear acceleration, which was a lot of fun and should probably affect the overall life of the motors but no noticeable difference except for top speed.

I've also added the famous WS2812B addressable Leds to see what else can this board do.

Eventually I've decided to learn KiCad and the redesign was done from the ground up while learning, at first, I've hated it, but now I'm really enjoying myself designing PCBs!

I'm not sure where this little project is going, but my key take away are the interesting research, the world of stepper motors is not a complete stranger, but this is not NEMA, magnetism and of-curse KiCad!

References:
Humans since 1982 are Bastian Bischoff (b. 1982, Germany) and Per Emanuelsson (b. 1982, Sweden). Since meeting as postgraduate students at HDK Göteborg in 2008, the duo have produced works that defy easy categorisation, situated between visual art and product design. Creating objects and experiential installations, their work manages to be analytical with a healthy dose of escapism.
Facebook: https://www.facebook.com/HumansSince1982/

If you want to buy one and not interested in the engineering part, just head to MoMA Design and you can also get a black one!

Another interesting idea which is somewhat related is Clock by Christiaan Postma, not sure if they are related in any way, still worth a look.

If you're looking only for source code:
Conor Hunt was also inspired by Humans since 1982 and wrote a javascript demo and shared the source code.
Jos Fabre was also inspired and made this demo.
Dmitry Yakimenko wrote an iOS app and published the source code and a demo.
Carlos Cabo wrote a webGL demo and shared the source code.
Takahashi Yuto wrote a demo in elm and shared the source code.
Nicolas Daniel wrote a demo and shared the source code.
Malte Wessel wrote a demo and shared the source code.
Ubayd Rahmonzoda wrote a demo and shared the source code.


There are already existing projects for trying to build a replica:
https://hackaday.com/2014/09/21/ask-hackaday-how-would-you-build-a-clock-clock/
https://hackaday.io/project/7872-clock-clock-clone
https://hackaday.io/project/4164-clock-clock

You might want to take a look at a discussion from mikrocontroller.net, its pretty old but there is some progress there and people are sharing their experiences.

Also, there's a single motor with breakout that someone sells on tindie.

Tags:

Wednesday, February 13, 2019

ESP32 IoT Device Management using LWM2M

Device Management means to connect, configure, control, monitor and update devices, individually or collectively.

The challenge can range from managing a single or multiple devices on the same location to managing thousands spread all over the world in other cases, to complicate things further, devices can connect in various ways, either through Ethernet, WiFi,Cellular, Lora, SMS and numerous other ways. It can use a slow or fast network, it can be connected all the time or just ping your servers once a day to save power, so many things to consider.



At about 2015 Open Mobile Alliance realized these challenges and released the first version of  Lightweight Machine to Machine standard, the standard describes device management using COAP protocol with UDP/DTLS or SMS transports, recently added TCP/TLS and even MQTT was added though its not part of the standard yet.

Source

So how does LWM2M help you with your device management needs?

LWM2M standardizes the way your devices will talk to your servers, the clients are very lean and designed to work on constrained devices, the connectivity has very low bandwidth needs and doesn't even require the devices to stay connected and that can fit a very broad spectrum of products, it can help you track your temperature sensors throughout your facility or even a buoy in the middle of the ocean, just imagine you can plan a firmware update to a device you'll never see again with maximum safety!

I've chose to implement firmware updates because I had an itch to try it on ESP32, while doing it I've also implemented a basic device that can turn a light on or off and report the current time and a few other properties.


The way I did it was to port wakaama and tinydtls to ESP32, about 90% of it worked without any modification, I've added WiFiManager and NTP Client to the mix and it just worked. (not very efficiently in terms of size though, but good enough for my experiment, the firmware was about 1.2MB in case you're wondering, out of it DTLS and Wakaama were about 100kb-200kb each and took about 6-10kb of RAM, leaving me with about 210kb of RAM which is not bad.)

As soon as it started connecting to my local Leshan Server, I've hooked into the firmware object the update function I've wrote, most of it based on esp-idf OTA with custom certificate validation and I've had a complete solution, the firmware and the signature would be sent over http/https, the completed firmware will be validated against the stored certificate and if it worked, the device will attempt to boot into the new firmware,a few diagnostics will be executed and if the device achieved connectivity and stability, it will mark the new firmware as valid.

The fun part started when I've sent the package URI (/5/0/1) to the device through Leshan Server and Executed the update (/5/0/2), the firmware was downloaded from a local web server, the device validated the firmware and finally rebooted into the new firmware.

Why firmware over-the-air is so important?


Lets agree that time to market is a critical business need, more than once we hear about superior devices and software being ditched because a significant player already got a grip on the market and trying to push a new product is hard if not impossible at times. Many times its the first product or the first player that wins the game.

To achieve a significantly short time to market compromises needs to be made, sometimes a scaled down product, less features and even compromises on a thinner layer of security are essential to get the product out of the door. Once a product gains significant traction and more resources becomes available, a better product can be developed, a more robust firmware, features as well as better security or even security vulnerabilities needs to be deployed while there is no physical access to devices. More over, device recall can kill a business and most companies try to avoid it at any cost. literally.

This is where firmware over-the-air comes in, assuming the device can connect to some kind of network, either by WiFI, or GPRS/3G or even SMS and LORA, it should be able to pull a firmware update when needed or it becomes available.

How does firmware over-the-air works?


Once a device has connectivity, it can either pull a firmware, for example from HTTP server or can be pushed a firmware, for example through COAP blockwise transfers, lets assume its relatively simple to implement it or already has a library available.

To support firmware updates more than once, the device will keep track on two partitions and switch between them every time the firmware is updated, this way the old firmware is kept until the device determines the new firmware is good enough to switch to permanently.

Lets drill down to the specifics of one way OTA can be implemented


  1. a device is configured with 2 application partitions, one for the factory application and a 2nd is left empty for future update.
  2. a device is notified of an available firmware, the OTA process can start.
  3. the device determines the next OTA partition for use, if it just went out of the factory, the 2nd partition is empty, if OTA was completed successfully, the first partition is available for the next update.
  4. firmware is downloaded directly to the available partition.
  5. the device validates the new firmware, for example with a checksum and/or a certificate.
  6. the device boots into the partition and makes sure it works as designed, so it checks the various sensors, network connectivity can still be achieved and either marks the new firmware as valid or invalid, if it crashes, either intentionally or through a watchdog, it will reboot back into the old partition.
I would argue that adding a secure validation on the new firmware is very important even if its only so it will not become another zombie in a large botnet.

The way I've implemented security in my experiment is as follows:

1. Generate a self signed certificate:
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365
2. Extract the public key:
openssl x509 -pubkey -noout -in cert.pem > pubkey.pem
3. Copy the public key into a certificate.h file
4. Create a new firmware and sign it:
openssl dgst -sha256 -sign key.pem -out firmware.signature firmware.bin
5. Copy both files to a web server, set the package URI and Execute the Update.


Though if you want to implement secure firmware on ESP32, you can do it "by the book".


OMA LWM2M Includes many device management options and includes on-boarding procedures, which is very important once your production reaches a certain number of devices since you won't be able to do it manually anymore.

You can monitor, configure and control your devices, you can request to be notified using the Observe mechanism and you can query the device state, send commands so the device will turn on or off a certain actuator, reset to factory defaults or even remote wipe a device if it comes to it.

And we can't really talk about LWM2M without talking about IPSO Smart Objects as well, which is a list of objects defining the structure of various sensors and actuators so you won't have to do it.

LWM2M is a lot of fun, you should definitely consider it in your next product!
Tags:

Saturday, November 3, 2018

Christopher Avery - The Responsibility Process®

I've had the honor of attending Christopher Avery's The Responsibility Process® workshop on October 28-29th 2018. We all cringe when we hear excuses or blame but it eludes some of us that shame and obligation are not the nirvana of responsibility though they feel almost as bad. To some people shame and obligation IS responsible behavior. Christopher worked with all of the participants on understanding how to responsibility is not Obligation, Shame, Justifying or Blame and how team members and management can start working on their own responsibility and inspire responsibility in others.


Christopher started the workshop by asking us to find the "Taxes" and "Dividends" of responsible teams and members, helping us to grasp what it is and what are the costs of not achieving responsibility within teams and our lives.

He then proceeded to explain the difference between these states and how they hurt us from both a personal view, team members and especially in management positions.

He explained why more accountability in organizations does not equal more responsibility, how to inspire responsible behavior and the 3 keys to responsibility:

  • Clear Intention
  • Focused Attention
  • Effective Action
We discussed the circles of control and power, how clarity leads to trust and how power comes from being able to stop-think-act (I'm paraphrasing from scuba diving rule book) while control circle is actually hurting decision making by having the illusion of fixing the problem while doing nothing to really solve anything other than feeding the stressful behavior.

We talked about why responsible teams are more productive and why collaboration will produce much higher results than winning, but what is winning if not collaborating?... (did you ever hear "its not our problem" or "you can't touch that" from your supervisor?)

Later we discussed trust issues between teams and members, how to build and rebuild trust and how to avoid losing it since its so hard to rebuild.

In the end of the workshop we all understood why responsible people and teams do a better job than any other team and how we can build our own teams and companies to be responsible for all of our successes.


I would like to say thanks to Practical Agile for enabling my attendance. Thank you Lior, Ilan and Dalit.



Resources:


Tags:

Tuesday, June 12, 2018

Tiny Model for MNIST Dataset

The MNIST database is a database of handwritten digits, its used as an ideal beginner dataset for learning how to do simple image classification and as the dataset only contains 10 characters, its relatively easy to work with.

It has 60000 tranining examples and 10000 testing examples and it is sufficiently large. as it has 60000 images of 28 x 28 grayscale images, it takes about 50MB, so it does not add complexity for batch generation since it can all fit in memory.

Like I said, ideal.


I think the first lesson I did on image classification was with MNIST database as well. it was very amusing to see a 1.2 million parameters model for a 50MB dataset, so I've decided to see how low I can go.

Lets start with the big one.

1.2m parameters - LeNet



CNN Error: 0.80%
train_loss 0.0082
train_acc 0.9984
val_loss: 0.0552
val_acc:0.9920
The graph does look like its overfitting by a bit.


My first experiment was using huge convolutions, I've managed to train 99% on 300k parameters, but I was not satisfied, surely there is a better way.

This model at 0.992 accuracy, with only 36k parameters (!!)


CNN Error: 0.72%
train_loss 0.0224
train_acc 0.9928
val_loss 0.0255
val_acc 0.9928

36k only? well, that's huge, I've looked around and found out its possible with under 4k parameters, so I set up for the challenge and came up with this model.

CNN Error: 0.90%
train_loss: 0.0369
train_acc: 0.9880
val_loss: 0.0285
val_acc: 0.9910

model is under 4k parameters (3.8)



To summarise what I've learned from this exercise is that larger models will learn faster but also overfit faster, smaller models need more training to find a better fit.


Credits

I would like to say thank you to EliteDataScience.com for getting this little exercise started



My 36k model:



My 4k model:

Tags:

Friday, April 27, 2018

Practical Sensing - RF

We, as humans, are so used to know who we are and where we are that we sometimes forget that it comes at a cost, a person sees where they are, they have an awareness (or general awareness) of their location in a room or on the street, they can also see a step (or feel if one is blind) and eventually know where obstacles are, get from a place to place and plan routes around obstacles.

https://pixabay.com/en/eye-internet-forward-vision-669157/

What can computers do? 

Radio Sensing

Radio sensing has been invented 1904 and while only capable of detecting a presence it has since evolved into many other sensors.

RF Radar has a few implementations, among them is presence, distance and movement, the principle is the same, an RF wave is transmitted, it is then reflected (or not) and the returned radio waves are detected, in more advanced scenarios, the received signal goes through FFT to detect the reflected timing/phase, which is further processed to get distance and/or speed of one or more objects.

Another implementation of radio sensing is localization, in its simplest form triangulation and more advanced is GPS which uses clocks to indicate when the signal was sent to better localize the receiver. BLE have been used for indoor navigation as well.

A different method of obtaining general location as long as you have network connectivity is using a service such as google geolocate which uses your IP and near by WIFI networks to guess the location.

An attempt was made to discover the hackability of Bosch Radars (diydrones, mikrocontroller) but so far without success.

Another form of electromagnetic sensing is a Geiger counter, which can be used to detect radiation, very useful if you want to detect Radon in your basement or take a relatively safe hike near Chernobyl.

Lastly Radio can be used as a cheap way to find out if a certain device is near another device or even communicate a secret of some sort.

Radar

Doppler - Doppler type sensors detect change or movement, one such cheap sensor is the HB100.

https://www.tindie.com/products/optimusdigital/hb100-microwave-sensor-module/


Distance - Sensors such as FM24-NP100 ($110) provide distance to the biggest reflection but also spectrum data which can be used to monitor multiple objects. These type of sensors measure the phase difference between two wavelengths.



Presence - Modules like the HW-MS03 (about $2) are in essence a Doppler radar combined with a timer to switch a pin/relay on or off.



Some radar modules (such as CFK024-5A for about $50) have FMCW tuning capabilities, which is very useful if you want to do a sweep which can be used to detect distance of multiple objects but it requires more than basic knowledge.


GPS

GPS receivers determine location by triangulating the timestamps and signals received from satellites, the more satellites, the more accurate the location will be. but GPS technology is limited by atmospheric conditions, limiting the accuracy possible.

GPS receivers have advanced over the years, GPS L1 and L2, GloNass, Galileo, Beidou and more, but the accuracy stayed more or less the same at this moment, the peak is around 2.5 meters accuracy for private use.

To overcome the accuracy limitations, a few augmentations were developed, some are over the air such as SBAS and QZSS, some are based on static base stations like DGPS and RTK.

Commercial RTK solutions are provided by drotek and Emlid to name a few.


BLE

BLE beacons are low energy (hence LE) devices which transmit a message once in a while, by reading the received power level (RSSI), it is possible to estimate the distance to the beacon. By knowing where the beacons are, it is possible to triangulate (called trilateration) the location of the receiver.



proximi.io (no affiliation) is one of the companies that does that kind of indoor positioning.

Nuclear Radiation

Following Fukushima disaster and Chernobyl tourism, personal radiation detection devices became more and more popular. 

Dosimeters available in Film Badges, MOSFET and Geiger-Muler tubes to name a few.


Proximity/Identity

Wireless identity devices are devices that contain a chip with a small coil, the coil is used to power up the chip and transmit data. two such devices are RFID and NFC devices.

Some devices have static data, some can store custom data, some can encrypt and authenticate but the principle is the same.

RFID more common types are the 125KHz and 13.56MHz and contain a 20 bytes ID and anywhere between 0 and 64 bytes of custom data.

13.56MHz module
125Khz module

One of the more interesting things about RFID is the tag sizes




NFC works much in the same way, memory capacity is between 48 bytes and 32kb.

Radio

While radio communication is not a sensor per say it is however a way to communicate and locate and can be used to sense location, state and various data.

Standard modules come in various frequencies and modulations, some even implement protocols, error correction and buffers.

Among the more popular ones are the 315Mhz, 433Mhz, 868Mhz, 915Mhz, depending on the country and local regulations and considered ISM band, which can be used for anything from car remotes, multirotor telemetry and various remote switches.

433Mhz RF transmitter and receiver 

XBEE, Bluetooth and WIFI are also considered ISM band but more robust implementations are available and are mostly used for higher bandwidth application.

XBee

Some of the more popular 2.4Ghz modules are the NRF24L01, A7105 and CC2500 which are used in RC Toys.

FrSky Taranis Q X7S

Lora, LoraWan, SigFox and NB-IOT are mostly used for smart appliances such as water meters, power meters and relatively long range and big coverage requirements and are very low bandwidth.

Cell (2G/3G and up) are used nowadays for anything from messaging to video playback.

SIM800L


References:

https://upcommons.upc.edu/bitstream/handle/2099.1/6629/PFC_MarcMirTutusaus.pdf?sequence=1
https://fccid.io/NF3ACC2SCU/User-Manual/Installer-Instructions-413993
https://etd.ohiolink.edu/!etd.send_file?accession=ohiou1304083389&disposition=inline
https://hackaday.com/2017/05/24/radar-sensors-put-to-the-test/

Tags: ,

Saturday, March 31, 2018

Practical Sensing - Physical

We, as humans, are so used to know who we are and where we are that we sometimes forget that it comes at a cost, a person sees where they are, they have an awareness (or general awareness) of their location in a room or on the street, they can also see a step (or feel if one is blind) and eventually know where obstacles are, get from a place to place and plan routes around obstacles.

https://pixabay.com/en/eye-internet-forward-vision-669157/

What can machines do? 

This is a quick introduction about sensors, what are the available options for a beginner maker/developer.

Physical Sensing

"Sensors" such as switches, magnetic, sound (or ultrasonic), pressure, temperature, flexing (or bending), shear (or weight), piezo, gas, capacitive and resistive sensors have been around the block, simple vacuum robots have some of them, cars have them (not necessarily self driving ones, see parking sensors) and even old refrigerators have them (someone has to turn on the light when you're hungry at 4AM).

Switches

Switches and buttons come in all shapes and sizes but the mechanical principle is the same, there are two (or more) spaced conductors, when a force is applied, one of the conductors (or a third) is moving toward them and makes a connection.

https://www.omron-ecb.co.kr/web/en/special/switch/basic02-05

Other types of switches can be limit, rocker, toggle, DIP, push buttons, thumbwheels and more, but the principle is the same applied in different ways and are represented very similarly.

https://www.edrawsoft.com/switch-symbols.php
Among these mechanic switches there are also simple tilt switches, they work by the same principle where a metal ball is the connection point.



Mercury tilt switches got infamous in the movies for less favoring reasons

Source



So what are switches and buttons good for?

Sensing mechanical contact, bumping into walls, rotational forces, etc'

What are they not good for?

Anything that requires precision and detection of the amount of pressure, they are on-off, nothing more.

Magnetic

A magnetic sensor is a type of sensor capable of sensing magnetic fields, magnetic fields are a directional field but the direction can not always be sensed, for example a reed switch will close (N.O) or open (N.C) based on the presence of magnetic field. We can also sense the presence and direction of a magnetic field with Hall Effect sensors (1D) and electronic compass if we require a 3D sensing of electric fields.



http://www.memsjournal.com/2011/02/motion-sensing-in-the-iphone-4-electronic-compass.html
These electronic compasses are so cool and sensitive you can use them to visualize a magnetic field!

Since hall sensors are so inexpensive and accurate, they can be used for rotational speed detection (odometry) and water/air flow sensors.



The principle is the same for most speed sensors, a moving part and a detector.

Source


Another very interesting application of hall sensor is 3D absolute sensing like the MLX90333:

Source


Another type of magnetic sensing is induction sensing, this is what metal detectors do, the way they work is by generating a strong magnetic field and detecting changes in the feedback, induction sensors are used in 3D printers to detect the build plate, they are pretty accurate and repeatable, but there are better sensors for that purpose as well and they are limited by the fact that they can only sense metals.

Common usages:
Neato Boundary Sensor


So what are they good for?
The reed switches are used as an on-off switch when a magnet is near by, the common example are windows and doors sensors for alarms. The hall effect sensors are used to precisely detect a magnetic object and the compasses are used to orient against magnetic north or artificial magnetic field.

What are they not good for?
If the environment is magnetically "dirty", many motors and magnets, both the hall effect and the compass are going to have a hard time "locking", also, electronic compasses are relatively slow, so they can not be used to keep the orientation for a moving object, for that purpose they are combined with accelerometers and gyros and their data is combined (or "fused" - see sensor fusion) to keep the robot oriented until the compass catches on.

Sound

Sound has very interesting properties with regard to robots, it bounces easily, its travelling relatively slow and sound sensors are abundant (microphones for example).

These leads us to a very simple implementation: distance sensors, they send a ping, wait for the response and report the time it took, Mechatronics has a nice tutorial.

Another very interesting usage is direction detection, I've seen 3 mic arrays, 6 mic arrays and they come with SDKs and can do noise reduction and direction detection.


Another interesting use for ultrasonic sound is indoor navigation, in theory, one can triangulate the source of a sound pulse by the time it takes to get to the transceivers.

Thanks to Marvelmind its no longer a theory:



Common usage would be distance sensors, atomizers, voice commands.

So what is it good for?

When you need to detect distance to a flat surface (rememebr, sound bounces..), when you need to reduce noise in a noisy environment or when you need to detect the direction of where the sound is coming from.

What is it not good for?

When the surfaces are not perpendicular to the sensor, sound will bounce all over the place, you should be thankful for any reading.

Interesting libraries:

Pressure

Pressure sensors are useful for many things, for hydraulic systems they can detect leaks, for water systems they can detect presence or water pump quality or even regulating pressure with a PID loop.

Water Pressure Sensor


Water pressure sensors can detect depth in submersible robots.

300m Depth/Pressure Sensor


Air Pressure sensors are also very useful for weather stations as they can detect weather fronts and predict rain.

Air Pressure sensors can also help multi-rotors keep a certain height, not accurately though, but good enough. Just don't count on them to work on bad weather, I've seen a multi-rotor drop 10 meters on a bad weather day and go back up in a blink of an eye, you can't blame the electronics..

A common type of air pressure sensor is the BMP280:

Air Pressure sensors are also used to detect speed in aircrafts.

All pressure sensors measure from a certain reference point, gauge, absolute and differential are relative and you should know what you need.

Make sure the pressure sensor is suitable for your medium and amount of stress its going to take, note the breakdown pressure so no one will lose an eye/finger and if dealing with high pressure, a suitable burst valve is always recommended.

Temperature

Temperature sensors are useful in cases when you need to know the temperature, for example, is your motor running hot? did the water boil already? is the oil too hot? is the printer's hotend at the right temperature? is it hot outside?

Like all other sensors, temperature sensors come in different flavors, but they divide into 2 groups: conduction and radiation sensors.

A common air/weather convection temperature sensor is the DHT11 and DHT22, these are very cheap:



A common type of conduction temperature sensor is the NTC 100k thermistor
Another common type of sensor is the contact-less IR temperature sensor, Melexis makes some of them:

BTW, the same principle applies for IR cameras, which produce these cool images:


Two consumer grade companies makes these sensors, Seek and FLIR, both cost around $200 for the cheap versions and of-curse you can get sensors only, but that is a different adventure.


Another kind of temperature sensor is the thermostats, which can be used for thermal protection, no sensing, just turn on the fan when its too hot, or turn off the power. they are not accurate but they do a good job for their designed purpose.

I've used the KSD9700 to quiet down a power supply that had a fan always on:


Lastly the PTC thermistors, they are a type of resistor that when they get too hot, their resistance jumps significantly, they are used to protect over-current and are regarded as self resetting fuse as the system cools off, the power returns to normal.

This is a nice kit to get started:


Flexing 

Flexing (or bending) sensors are basically resistors that change their resistance when they are bent, they are great for human interaction since, if you think about it, we have many joints that flex and tracking these flexing movements is not trivial by other means, so gloves, sleeves, tights, if it bends, you can detect it with these little sensors.

Be careful though, these sensors are not cheap and the material melts away if attempting to solder it, you might be able to fix it with conductive silver paint, avoid heat as much as possible and avoid rubbing it in the exposed areas.

Here's a 2.2" flex sensor, they come at various lengths:

Shear / Load Cell / Weight

Shear beam, Load Cells and Weight sensors all come fromt he same family of sensors, they change resistance according to the deformation that is sensed in the metal. They are used in scales and testing machines. One might want to use them to test a load on a mechanical arm for example so they can stop a motor if the weight becomes dangerous or avoid breaking something if an arm is attempting to open a door.

Here's an example of a 10KG weight sensor:

Piezo

Piezo sensors have many uses, a piezo crystal is either flexing when power is applied to it, thus can make a sound or it can generate power when a force is applied to it. due to these features piezo are versatile.

Piezo have been used as microphones, especially where vibration plays a big role, for example, as a guitar pickup microphone.

Source
Wait what? guitars? aren't we talking about robotics? well, lets repurpose these sensors a bit, say you have a motor running, 24/7, that motor have bearings and like all bearings they wear off, you can claim that if your motor is running 24/7 you can calculate the service times, but what happens if the motor is under load only a few times a day and this changes the service time significantly. by detecting the vibrations coming off the motor, you can predict mechanical failure.

Since piezo generate power on change, they can be used to detect "knocks" (or bumps or clicks) or even heartbeat!

Gas

Gas sensors mostly split into two groups, spectroscopic sensing and chemical reaction sensing. while spectroscopic have a very long life, the chemical reaction ones have a relatively short lifespan and the catalyst will eventually deplete and no longer detect anything or detection accuracy will be low enough to make it useless.

Another type gas sensor is dust sensor, such as GP2Y1014AU0F:

Source
CO2 sensors for example, come in a few different ways, for example, chemical (MG811) and spectroscopic (MH-Z19):

MH-Z19 - NDIR sensor
MG811 - Chemical Sensor

Other types of sensors are 
Combustible Gas ( LPG, Propane, Hydrogen, Methane and other combustible steam) - MQ-2
Alcohol/Ethanol and Benzine - MQ-3
Combustible gas (Methane, Propane and Butane) - MQ-4
LPG, natural gas , town gas - MQ-5
LPG, iso-butane, propane - MQ-6
CO - MQ-7
Hydrogen - MQ-8
LPG, CO, and Methane - MQ-9
Ozone - MQ131
Ammonia, nitrogen oxide, alcohols, aromatic compounds, sulfide and smoke - MQ-135
Hydrogen sulfide - MQ136
Ammonia - MQ137 
Toluene, Acetone, Ethanol and Formaldehyde - MQ138 
Freon - MQ139
Methane LPG, i-butane, Propane - MQ-214
Alcohol - MQ303A  / MQ303B 
CO2 Low Power - MG-812

Natural gas, LPG, Coal gas, alkane ect combustible gas, and gasoline, Alcohol, ketone, benzene ect organic solvent - MC113

CO2 - MG811

Methane - MP7217
Alcohol,smoke,formaldehyde, toluene, acetone, benzene, lighter gas, paint - MP901
Formaldehyde - ME3M-CH2O
Ammonia - ME3-NH


Organic Solvent Vapors - TGS822
Carbon Monoxide - TGS2442 
Air Contaminants - hydrogen and carbon monoxide - TGS2600
Air Contaminants - odorous gases such as ammonia and H2S - TGS2602
Air Contaminants - odorous gases such as amine-series and sulfurous odors - TGS2603
LP gas - TGS2610
Methane - TGS2611
Solvent Vapors - TGS2620
Carbon Monoxide - TGS2442
Carbon Dioxide - TGS4161 
Carbon Monoxide - TGS5042

VOCs gases (toluene, formaldehyde, benzene, ect.) - MS1100

Methane Butane Hydrogen - MR511 

Most combustible gases and vapors  - CLE-0951-400
Nitric Oxide - 4NO-2000

Oxygen - O2-A2 / AO2 / 2FO-N / KE-25 / ZE07-CO / ME2-O2 ME3-O2 / 4OXV O2 /  ME3-C2H4O / OOM201 

So there's practically a sensor for almost any need, most of them are decently priced.

Resistive

In general, resistive sensors are a large class of sensors, among them are the previously written topics of load cells, flexing, temperature and various pressure sensors, they property of the material changes conductivity based on the forces and temperatures applied on them, some of these sensors need some kind of temperature compensation as resistance changes with temperature as well.

Other types of resistive sensors are resistive touch screens, which work by changing the resistance with the force and place the mechanical stress is applied, that's why they work best with a stylus since a finger might apply force on more than a small location, thus changing the sensed resistance and eventually leading to bad localization. Another problem with resistive touch screens is temperature which affects accuracy.

In the end resistive touch screens were abandoned but that technology is not completely useless, here's an example for a foot pressure point sensor:


Resistive sensors can also detect rotation angle, for example, potentiometers, and slide, as slide potentiometers.

Analog servo motors use potentiometers, but the same principle applies, you can use a multi turn potentiometer to achieve multiple turn servo!

Source
Linear Servo


Capacitive

Capacitive sensors work by detecting conductivity different than air which makes them useful for many things and they don't suffer from the same problems resistance sensors.

Common usage is touchpads, phone screens, touch buttons, capacitive proximity sensors and capacitive soil moisture sensor which doesn't corrode as easily as resistive ones.

Capacitive Touchpad
http://www.cirque.com/capacitive-touch/
Touch Sensor

Soil Moisture Sensor
Proximity Sensor


Current/Voltage

Current sensors/voltage sensors are very important to keep a limited system within the power supply's boundaries or keeping a Lithium battery alive when the power runs out, so the battery voltage won't get below 3.2v (or its limit) per cell.

DC Voltage sensing can use a very simple voltage divider. and AC Voltage can use the same principle except that we need to put a rectifier in front of it.
Source
Current sensing on AC works by induction, while DC current sensor works by measuring the voltage across a very low reistance component, such as a short wire, a 0.1/0.001 ohm resistor or dedicated sensors such as ACS758.

Non-invasive AC current sensor

100Amp AC/DC Current Sensor Module Board, based on ACS758

Biological

Biological sensors are useful for detecting or authenticating a person, so if your robot depends on someone's pulse or blood oxygen level, you can use a pulse oximeter for that, its a non invasive sensor that measures the difference between IR and red light absorbance of skin.

MAX30100 Pulse Oximeter


Another thing someone might want to sense is muscle/heart/brain signals, which can be done with EMG/ECG/EEG sensors.
Muscle Signal EMG Sensor
ECG module AD8232
8bit EEG brain wave module -8 Channel 

Fingerprints, lately it seems fingerprint sensors are all over the place, you can get them very cheaply and in various sizes. A very fun project I've seen someone do is build thor's hammer with fingerprint reader.

FPM10A Fingerprint Reader Sensor





Tags: