Adding an SD Card Shield for Data Storage —
In Parts 4 and 5, the YellowJacket Wifi board was used as a web page server or to request a web page from a remote NOAA weather server. The wifi connection was to the local network which had remote internet connectivity through wired ethernet and to devices through local wireless wifi.
In this Part 6, an Adafruit SD Card is added for data storage. In later blogs, a sensor shield will be developed to collect data for storage on the SD Card and for transmission over wifi between two YellowJacket Arduinos and Macs on the local wifi network. The data will also be stored in a mySQL data base on a Mac. YellowJacket memory will also be expanded using a FRAM memory card and SPI.
Adafruit SD Card Shield
The SD Card Shield uses stackable headers so it can be used with other Arduino Shields. The SD Card Shield has a real time clock which is fairly accurate to time-stamp data that is stored on the SD Memory Card. The YellowJacket board does not have a real-time clock, so the SD Card Shield can provide that function.
One conflict among various Shields is the pin that is used as the SPI-CS pin for each particular SPI device. The Adafruit SD Card Shield has pin 10 hard-wired on the board and was modified by cutting the circuit board copper trace. The SD Card SPI-CS was then moved from pin 10 to pin 7 since the YJ had CS hard-wired to pin 10. YJ uses pin 9 for the wifi-active LED and YJ uses pin D8 as the wifi hibernate interrupt pin. The YJ runs sketches using the SD Card Shield with CS=pin 7. When SD Card CS was set to pin 8 (wifi hibernate), there was a conflict with WiServer sketches that would not init. The SD Card Shield has pin 3 jumpered to ==> green LED1; pin 4 jumpered to ==> red LED2; pin 13 ==> SD Card Shield red LED which is also the YJ pin 13 green SPI-CLK LED. Analog pins A4 and A5 are used by I2C connections to the Real Time Clock RTC.
With the SD Card Shield stacked with a YJ Shield, the various Adafruit SD Library example sketches could be compiled and run. Each sketch had to have the “const int chipSelect = 7;” modified to use pin 7 as the SD CS pin.
During sketch testing, SD Card Shield connections L1 and L2 were disconnected to use pins D3 and D4 for other purposes.
YJ Arduino and Custom Shield Pin Assignments
At this point we will take another look at hardware pin assignments on the YellowJacket Arduino with MRF24MB0MA Wifi backpack. The following list explains which pins are used for which purpose and identifies pins that are available for use in sketches.
- Module spi_WS.h assigns INT0 (Pin D2) as WiShield interrupt.
- Module g2100.h Driver for the ZeroG Wireless G2100 series devices also assigns ZG_INTERRUPT_PIN INT0 to Arduino D2.
- Pin D0 ==> YJ-RX1 to Shield D0 (RX0), is also used for programming Arduino
- Pin D1 ==> YJ-TX0 to Shield D1 (TX1), is also used for programming Arduino. YJ-TX0 is normally high, and blinks (LED/resistor to GND) low when data is sent out.
- Pin D2 ==> Interrupt Out from MRF24 pin 33 ; (no Wifi Init conflict with SD Shield); D2 is hardware interrupt INT0 signal from MRF24, low=data transfer from MRF24, hi=MRF24 data transfer complete; D2 normally high, blinks (LED/resistor to GND) low during Wifi activity.
- Pin D3 ==> N/C (INT1 and PWM) on YJ; SD Card Shield wires pin3 to LED1.
- Pin D4 ==> N/C on YJ; SD Card Shield wires pin4 to LED2.
- Pin D5 ==> N/C (PWM) on YJ
- Pin D6 ==> N/C (PWM) on YJ
- Pin D7 ==> N/C on YJ. SD Card Shield wires pin7 to SPI-CS
- Pin D8 ==> Normally Low MRF24 CE ‘Hibernate’ off; High = Hibernate state. (WiServer Init conflict with SD Shield CS=pin 8)
- Pin D9 ==> YJ (PWM) Wired to WIFI Active Green LED9. Used to indicate when Wifi is enabled=LED lit, set in uIP software.
- Pin D10 ==> YJ (PWM) SPI CS/SS for MRF24 Wifi. MRF24 SS selected when LOW.
- Pin D11 ==> YJ (PWM) SPI MISO/SDO. (Master In Slave Out)
- Pin D12 ==> YJ SPI MOSI/SDI (Master Out Slave In)
- Pin D13 ==> YJ SPI SCLK / SPI Green LED13 (SPI Clock)
- Gnd ==> YJ GND
- ARef ==> Test Point on 328P goes to N/C
- SDA ==> N/C on YJ custom shield. Would connect to pin A4 for I2C.
- SCL ==> N/C on YJ custom shield. Would connect to pin A5 for I2C.
- Pin A0 ==> N/C on YJ
- Pin A1 ==> N/C on YJ
- Pin A2 ==> N/C on YJ
- Pin A3 ==> N/C on YJ
- Pin A4 ==> N/C on YJ. Used for I2C SDA in sketches. Used by SD RTC for I2C.
- Pin A5 ==> N/C on YJ. Used for I2C SCL in sketches. Used by SD RTC for I2C.
- RAW ==> YJ RAW is connected to Shield Vin >7 VDC. Onboard 5V and 3.3V converter from RAW to VCC and 3V3.
- Gnd ==> YJ GND
- 5V ==> VCC 5V from RAW, shield VCC, or USB programming header
- 3.3V ==> 3V3 from RAW, onboard VCC, or shield VCC.
- ** WARNING the MRF24 is a 3.3V device.
- RST ==> Reset when pin is low; normally high.
- Arduino PWM digital pins are pins 3, 5, 6, 9, 10, and 11.
MRF24WB0MA Pin Interactions
- MRF24 Hibernate to YJ pin D8 has no effect on YJ pin D9 LED.
- D8 LOW=0V for Hibernate Off; D8 HIGH=3V3 for Hibernate On;
- During sketch, if D8 is switched HIGH, MRF24 fails to re-engage activity once D8 is set LOW.
- MRF24 will INIT with D8=0V GND or as normal D8=N/C.
- MRF24 will not INIT with D8=3V3, and does not INIT after setting D8=LOW or 0V.
- YJ pin D10 is 4.84V when WiServer sketch is running, which is holding the CS/SS pin HIGH. MRF24 SS is selected for SPI when LOW.
- Connecting D10 to D3 SD Card Shield LED1, lights the LED1 but kills the Wifi connection.
- After removing the D10=>D3, closing and re-opening Serial Monitor reboots the sketch and the Wifi connects. D10=>10K resistor=>D3 lights LED1 dim but Wifi continues to work.
(Feb 29, 2016)
No comments:
Post a Comment