Project day at Grand Valley is coming up tomorrow and the Chrono-tomic team has been busy preparing. We recently added an RF shield to prevent the WWVB antenna from picking up noise from the Arduino. The software was fine tuned and verified using the C-MAX module to receive the WWVB signal.
An essential part to any good project day presentation is the tri-fold. Here’s a link to a PDF of our project day poster.
So what do you do when you want to get some sleep, but have a project that receives the WWVB signal best at night? Well, we wrote an Arduino sketch that interprets debug codes sent from the shield and sends a formatted output to the Arduino IDE serial monitor and an external datalogger. We used an external datalogger since the USB connection seemed to introduce a fair amount of noise into the system. Keeping computers away from the shield in general seemed to help a lot as well. The OpenLog serial datalogger enabled us to store the debug output from the Arduino to an SD card to view later in the daytime
Arduino Debug Sketch -GitHub
OpenLog - SparkFun
Here’s a sampling of the debug output that this sketch gave us (1 = binary one, 0 = binary 0, 2 = frame marker, 3 = error):
000000102011000001200010000022 DOUBLE SYNC MARKER
0110010020000000102010000001200010000022 DOUBLE SYNC MARKER
000022 DOUBLE SYNC MARKER
01100110200000100120011001002000000010201000000120001000002 FRAME: 2 DOUBLE SYNC MARKER
11100111200000100120311001002000000010201000000120001000002 FRAME: 2 DOUBLE SYNC MARKER
01101000200000100120011301002000000010201000000120001000002 FRAME: 0 80 23 9 A 6 12 11 2 DOUBLE SYNC MARKER
11101001200000100120011001002000000010201000000120001000002 FRAME: 2 DOUBLE SYNC MARKER
10000000200000110120011001002000000010201000000120001000002 FRAME: 0 80 38 9 A 6 12 11 3 1
The GERBER files for our project have now been sent to Advanced Circuits for manufacturing, so that means it’s coding time for the Chrono-tomic crew. Our first task was getting the I2C bus communication between the PIC, RTC and Arduino functioning. We currently are able to write to a slave device from the PIC using our I2C library. Read capability has been implemented but is yet untested. In this post, we will show you what goes on during I2C communication between two devices.
Here is what goes on when the PIC master is communicating with a slave (PCF8574 in this example):
I2C Data Explanation
- Start Condition
The master pulls the SDA line low while the clock is HIGH to initiate a start condition. This tells the slaves on the bus to listen to see if they will be addressed. The start condition is held for about 5µs, then the SCL line is pulled low.
- Addressing the slave device
I2C is a multi-drop system, so multiple slave/master devices can share the same bus. Slave devices have to be addressed so that instructions from the master go to only one device at a time. The address of the PCF8574 used in our testing was 0×80, as shown in the picture. The least significant bit (LSB) of the address is a 0, indicating to the slave that the master is going to write data to it. The LSB of the address is set to 1 if information is being requested from the slave.
- Slave acknowledge
After the 8 bit address has been sent out on the bus by the master, the master lets the SDA line start to float HIGH. If there is a slave connected to the bus who recognizes that address, the slave pulls the SDA line LOW for the 9th bit in the sequence to acknowledge the address.
- Send data to slave
The master then sends a byte of data at a time to the slave. In this example, each bit in the byte sent to the PCF8574 (an 8-bit port expander) controls an output pin. In the picture, the master sends all zeros to tell the slave to turn all the outputs OFF.
- Slave acknowledge transmission
After the master sends a byte of data, the slave will acknowledge or non-acknowledge each byte in the same way as addresses on the 9th bit.
- Stop condition
The stop condition (not pictured), similar to the start condition, is sent to all devices on the bus to signal that communication is done and other masters may use the bus.
Our media from the EGR326 design review presentation is now available! Hit up the links below to check it out…
Explanation of Schematic
EGR326 Design Review Presentation – Nov 4, 2011
PIC Timer2 1ms Interrupt Testing
This project will be using a PIC16F1823 microcontroller to interpret the WWVB signal. This microcontroller includes numerous useful hardware features such as timers, digital I/O, analog inputs and other features that GVSU students will be familiar with after taking EGR226 and using the ATMega 326P.
Timer1 Gate Interrupt Testing
This interpreter will be using two timers to interpret the WWVB signal, a gated timer interrupt on Timer1 and a compare match interrupt on Timer2. The 16 bit Timer1 module will be used to time the width of the pulse received from the WWVB radio. The gate feature enables us to time the pulse width easily since the timer can be configured to count only when an input to a pin is high. Timer2 is configured to trigger an interrupt every 1ms using a counter compare method. This interrupt is used for keeping track of the current position in the WWVB transmission and other processing tasks.