Leilani | How to Make

Creative

Input Devices

Preparation

This week we were assigned to probe an input device's analog levels and digitial signals. Since my final project is concerned with detecting water and other elements within a women's handbag, I decided to first search for water and humidity sensors. First I looked on digi-key. and found a couple interesting candidates and data sheets. But in order to make sure I would have something to show this week, I ordered some arduino parts from Amazon. I focused on the arduino DHT22.

sensors

I also had not checked my programmer, but I wanted to make sure that I could use it. The additional parts I would need are:

  • a male female USB for the programmer for safety
  • a serial to USB ftdi cable for power and communication
  • six-pin ribbon connectors (which I could have, but did not make in lab).

Programmer

I have struggled with some of the electronics production and embedding programming assignments due to a couple reasons. One, I do not have a linux laptop (I have a mac), and two, my mac with USB-C ports does not seem to recognize USB connections even when I use a slower converter. So part of my job this week was setting up my programming environment on my work desktop.

new
		office setup

As a first step, I had to get my programmer working. As a first step, the USB connection was recognized by my work desktop, (notice the light is on), horray!

let
		there be light let
		there be light

Next, I downloaded the firmware source code which is linked from Brian's page. I was able to run make and start to program the ATtiny 45.

Now it was time to program the ATtiny45. The first thing to do is to use an existing programmer. I was able to use an existing programmer ATtiny45 from class. So, in the Makefile, nothing had to be changed since the "PROGRAMMER ?= usbtiny" remains. I connected everything corrected (pin1 was conntected to pin1) and successfully was able to run make flash. However, lsusb did not display the "Multiple Vendors USBtiny" device, although dmesg showed it existed, and suggested the usb connection make not be good.

Programming

Although the programmer did not work, I was able to go into the lab to use the programmer there. The humidity sensor that I am using has three pins which will need to be connected to the microcontroller

  • + : which needs to be connected to the voltage
  • - : which needs to be connected to ground
  • out : which needs to be conntected to a gpio pin like MISO or MOSI
wiring of the sensor

Although I was able to add some new code to my hello world board, I was not able to get the appropriate code to work with the new humidity sensor, I will work on this more next week!

light on!

Another Idea

Instead of using a humidity sensor, what if I sewed conductive wires right into the bag. The ides is to sew two conductive wires close together in the bottom of my bag. One wire is high the other sire is low. The wires have to be very close together, but they do not tough. Then if liquid is spilled in the bag, the liquid will connect the circuit and the higher the current the bigger the water spill.

wires! wires! wires together

I designed a board in KiCad with a screw terminal for 2 wires. I screwed two larger wires in the screw terminal and then attached two thinner wires with solder.

wires! wires!

Since I needed drill holes, this became the first time that I used the OtherMill! I learned how to export gerber files, by going to file -> plot and generating the files. In addition, you also have to generate the drill files.

I have had trouble programming the board (how to determine what is the current of the board), but this will be done by my final project!

UPDATE- I found how to program the board, and read in the current witout having to use a serial connection! This is a proof of concept where the light will go on if the wires are touching (similarly to how a high and low wire will be connected on in fabric for the water board. The code is available here. The big thing to notice is that I am able to read in the value from the low wire, and if it's getting any current, and will write something to serial, then I want to turn on the light.

The main idea is to read the high byte from the low wire:

readADCeight(&highByte);

outchar = (char) (highByte>>1);
put_char(outchar);
if(outchar){
  set(PORTB, (1 << PB2));  // Turn on the led
}
else{
  clear(PORTB, (1 << PB2));
}
 _delay_ms(500);