Input Devices

Back to Mónica Pedro ←main page ←Assigments

        individual assignment:
        add an output  device to a microcontroller  board you've designed,
         and  program  it to do something
    

Program an Input

I'm very interested in knowing hot to process data coming from a sensor produced in the Lab, and want to understand how some of them work, so for starting this assigment I produced some of teacher Neil...

Temperature Sensor

So I made a Temperature Board

but as is documented above, it was a quite long and frustating crusate to program the board

and will programming it with Atmel-ICE

So downloaded the programs to a folder "Temperature" and CD to it, wher I'd used the comand

make -f hello.temp.45.make

make -f hello.temp.45.make program-ice

Does not worked... PROBLEM

Atmel-ICE on MAC OS Sierra

when lokking for suppor online I found a nice overview in AVRDude and Atmel ICE on OSX 10.3 High Sierra

sudo cp -r ~/Downloads/AtmelICE.kext /Library/Extensions

sudo kextload -v /Library/Extensions/AtmelICE.kext

Stil continue with the permissions problem... so I'd made

sudo chown -R root:wheel /Library/Extensions/AtmelICE.kext

sudo chmod -R 755 /Library/Extensions/AtmelICE.kext

sudo kextcache -system-caches

this last one showed the permissions problems os MAC OS SIERRA

So I'll Turn Off the System Integrity Protection of my system...

I've Reboted the system and used the keys CMD+R to access the booting and on the terminal window used the command

csrutil disable; reboot

made all the previous steps and boot the system again... and it continues to do the same error:

After 4 hours trying to use Atmel-ICE in my MAC OS Sierra, i decided to go for a walk... and forget it...

...................

Atmel-ICE on a Linux

Plain and simple... it worked perfectly

make -f hello.temp.45.make

since it worked, now verify if the Atmel-ICE is set in Make file with the command:

cat hello.temp.45.make

it was, so i continued with..

make -f hello.temp.45.make program-ice

UAU... at first attemp it worked.... which reinforces my saing: Forget Atmel-ICE on a MAC...

next would be to use the TERMinal app developed by professor Neil "hello.term.45.py"

make -f hello.temp.45.make program-ice

pyhton hello.term.45.py

ERROR... it was needed to install some software... Tkinter

sudo apt-get install python-tk

OOK.... now

pyhton hello.term.45.py

Another problem...... Need of numpy

sudo apt install python-numpy

pyhton hello.term.45.py

Answer: Command line: hello.temp.45.py erial_port

to figure out the serial ports used the command

dmseg | grep tty

pyhton hello.term.45.py /dev/ttyUSB0

[Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'

sudo pyhton hello.term.45.py /dev/ttyUSB0

UAUU-... worked

Add an input to my board

Moisture Sensor

What's Moisture measuring?

SparkFun Soil Moisture Sensor uses two large exposed pads as probes for the sensor, together acting as a variable resistor:

the Moisture sensor I've in my lab is quite basic, and the information found online is not precise...

Moisture Sensor from ACCROW

Try it out with Arduino Programmer

Connecting it to Arduino as ISP

Moisture Sensor pins - Arduino Pins

Sample code on Arduino

after Verify and UpLoad, open the serial port and:

DHT11 - temperature & humidity Sensor

Adafruit overvew of DHT's sensors

about Dht11

But how does DHT11 works!?

found a very good documentation....DHT11 & DHT22 Sensors Temperature and Humidity

and here: How DHT11 DHT22 Sensors Work & Interface With Arduino

 
the humidity sensing component uses two electrods 
  with moisture holding substracte between them
    So as the humidity changes, the conductivity of the substract changes 
      or the resistance between these electrodes changes. 
This change in resistance is measured 
  and processed by the IC 
      which makes it ready to be read by the microcontroller.
The substract (usally is a salt or conductive plastic polymer)
    The ions are released by the substract as water vapor is absorved by it, 
         which in turn increases the conductivity between the electrods.
The change in resistance between the two electods is proportional to the relative humidity
    higher relative humidity decreases the resistance between electrodes, while
         lower relative humidity increases the resistance between the electrodes.
         
 
the NTC temperature sensor is a  thermistor 
    a thermistor is a thermal resistor: 
        a resistir that changes its resistance with change of the temperature. 
    These sensors are made by sintering of  semiconductive materials 
        such as ceramics or polymers 
            in order to provide larger changes in the resistance  with just small changes in temperature.
The term “NTC” means “Negative Temperature Coefficient”, 
    which means that the resistance decreases with increase of the temperature.

                

Try it out with Arduino Programmer

Connecting it to Arduino as ISP

DHT11 pins - Arduino Pins

Lets analyse the code

#include "DHT.h"

.............. will inlcude in compiling the "DHT.h" library

DHT library in Arduino website

#define DHTPIN 2

.............. creates a varibale called "DHTPIN with a value of "2"

#define DHTTYPE DHT11

.............. creates a varibale called "DHTTYPE with a value of "DHT11"

DHT dht(DHTPIN, DHTTYPE)

.............. sends a comand to the funtion "dht" existent in the Lybrary DHT, sending to that function the previous created variables (DHTPIN and DHTTYPE)

Adding Moisture and DHT11 to my board

making a my board for Moisture + DHT11

used EAGLE to design a board using two different microcontrollers

Atmega328P

My board for Moisture + DHT11 Schematic
My board for Moisture + DHT11 Board

I want to try to make it flexible, so I made a image to cut in Vynil Cutter

My board for Moisture + DHT11 Board for Vinyl Cutter

Attiny44

My board for Moisture + DHT11 Schematic
My board for Moisture + DHT11 Schematic

Inputs in Attiny44 programming