This week I made the async serial communication board. Since for my final project I am investigating capacitive sensing, I added to node 0 and 1 a step response capacitive sensors, and left node 2 and 3 as simple LED nodes.
BOARD COMPONENTS
NODE 0 BRIDGE:
1 x ATTINY45
1 x 3X2 PIN HEADER (ARVISP SMD)
2 X 2X2 PIN HEADER SMD
1 X FTDI SMD HEADER
1 x CAPACITOR 1 uf
1 X 10 k Ohm RESISTOR RES-US1206FAB
1 X LED 1206 smd
1 X 1 k Ohm RESISTOR RES-US1206FAB
1 X 1M Ohm RESISTOR RES-US1206FAB
NODE 1:
1 x ATTINY45
1 x 3X2 PIN HEADER (ARVISP SMD)
2 X 2X2 PIN HEADER SMD
1 x CAPACITOR 1 uf
1 X 10 k Ohm RESISTOR RES-US1206FAB
1 X LED 1206 smd
1 X 1 k Ohm RESISTOR RES-US1206FAB
1 X 1M Ohm RESISTOR RES-US1206FAB
NODE 2 & 3 :
1 x ATTINY45
1 x 3X2 PIN HEADER (ARVISP SMD)
2 X 2X2 PIN HEADER SMD
1 x CAPACITOR 1 uf
1 X 10 k Ohm RESISTOR RES-US1206FAB
1 X LED 1206 smd
1 X 1 k Ohm RESISTOR RES-US1206FAB
ATTINY45 CONFIGURATION
NODE 0 BRIDGE & NODE 1:
PB5 : RST
PB3 : TX
PB4 : RX
GND
VCC
PB2/ADC1 : SCK/SENSEPIN (ELECTRODE ATTACHED)
PB1 : MISO/STEPPIN
PB0 : MOSI/LEDPIN
NODE 2 & 3:
PB5 : RST
PB3 : TX
PB4 : RX
GND
VCC
PB2/ADC1 : SCK
PB1 : MISO
PB0 : MOSI/LEDPIN
BOARDS DESIGN
PROGRAMMED BOARDS
First I tested Neil's code to make sure that my boards were working fine. To do so I programmed each board individually with the same code, but changing the identity of each single node.
Once programmed I connected all boards with a GND-VCC-TX-RX cable, and powered through the FTDI cable. When opening the Serial Port on Arduino, by typing numbers on it each board will flash, but also, the board whose identity corresponds to the number typed will flash a second time and send a message to the serial port.
Next I tried to implement a sketch in C code for 2 nodes.
The first node would sense capacitance (and flash while sending information), The second node would receive the sensor values and blink only when the values would be within a threshold (>500).
Funny thing... The second board is somehow responsive to the values received via serial port, however, instead of switching off when outside the range defined, it actually flashes slowlier...
To be further investigated....
In node1 I am sending the chars
put_char(&serial_port, serial_rx, up_lo);
char_delay();
put_char(&serial_port, serial_rx, up_hi);
char_delay();
put_char(&serial_port, serial_rx, down_lo);
char_delay();
put_char(&serial_port, serial_rx, down_hi);
char_delay();
to the serial port. In node2 I am borrowing the code written by Neil for python, adapting it to run in C, and combining these values to get the actual readings.
//
// FIND FRAMING
//
byte1 = byte2;
byte2 = byte3;
byte3 = byte4;
get_char(&serial_pins, serial_rx, &byte4); // TX & address
if ((byte1 == 1) & (byte2 == 2) & (byte3 == 3) & (byte4 == 4)){
break;
}
//
// READ AND PLOT VALUES
//
get_char(&serial_pins, serial_rx, &up_low); //get values from serial port
get_char(&serial_pins, serial_rx, &up_high);
get_char(&serial_pins, serial_rx, &down_low);
get_char(&serial_pins, serial_rx, &down_high);
up_value = 256*up_high + up_low;
down_value = 256*down_high + down_low;
value = (up_value + (1023 - down_value))/2.0;
FILES DOWNLOAD LINK
HOME | ABOUT | WORK | CONTACT
Francesca Perona © 2015
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License
Original open source HTML and CSS files
Second HTML and CSS source
Francesca Perona © 2015
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License
Original open source HTML and CSS files
Second HTML and CSS source