Presentation is loading. Please wait.

Presentation is loading. Please wait.

AAPT workshop W03 July 26, 2014 Saint Cloud State University, MN, USA

Similar presentations


Presentation on theme: "AAPT workshop W03 July 26, 2014 Saint Cloud State University, MN, USA"— Presentation transcript:

1 AAPT workshop W03 July 26, 2014 Saint Cloud State University, MN, USA zliu@stcloudstate.edu

2 CH4: OSPL Device cost Device features How to use the LCD How to use the rotary encoder Simple user interface Set up the Bluetooth module How to use the micro-SD card The standard firmware The next hardware revision How to get more devices

3 OSPL features 3 DIN-5 plugs with 40N insertion/extraction force Two analog or digital inputs per plug, one with on- board 10Kohm pull-up resistors, making wiring resistive and open-drain sensors very easy Micro-SD card slot with dedicated 3.3V power supply and level shifter that supports SDHC cards up to 32GB LCD and rotary encoder for easy user interface Bluetooth socket for wireless control or data transfer Pin A6 senses battery voltage with a 22Kohm/10Kohm voltage divider

4 Schematic V 2.1.6 1 2 3 4 1.10Kohm pull-up resistors 2.Din-5 plug 3.LCD back light jumper 4.Bluetooth TX jumper 5.To sense battery voltage, read channel A6. and multiply by (10+22)/10=3.2. 6.To use the buzzer, call tone() with pin 8. 5 6

5 Schematic (cont.) 1.10Kohm resistors between A1, A3, A5 and 5V to sense Vernier sensor AUTO-ID resistors, thermistor, photo resistors, photo transistors, and open-drain sensors without having to include a resistor in your wiring. 2.Din-5 plug wiring shows on the diagram 3.Removing this jumper disables back light saves battery. 4.Removing this jumper enables the USB serial port to talk with OSPL, inserting it enables Bluetooth module to take to OSPL. 1 234

6 OSPL Cost: $60 if you wish to purchase parts for one unit $40 parts if you purchase parts for 25 units Standalone and needs no PC or mobile device Sensors can be constructed from parts for a few dollars Future models (V 2.2 and up) will be fully assembled. For part costs, please refer to the Bill of Materials (BOM) spreadsheet in the design folder.

7 LCD 1 2 3 1.Include library 2.LCD size and pins used to drive it. 3.Create lcd object 4.Initialize lcd 5.Clear lcd 6.Set cursor before every print. 7.There is only print and no println. 4 5 6 7 Printing on lcd takes tens of milliseconds so don’t print to it when sensing photo gates.

8 Rotary encoder 1 2 3 4 5 6

9 Messages and lists Display a long scrollable message on the LCD, use rotary encoder to read it and dismiss with shaft click simple_text_area(message_to_display); response=simple_select_list("Day of week:\nSUN\nMON\nTUE\nWED\nTHU\nFRI\nSAT\n"); Display a select list with title on the LCD, use rotary encoder to highlight an item and shaft click to select int choice=simple_select_list(list_with_title); simple_text_area("Developed by:\nDr.Liu 11/25/12\nhttp://liudr. wordpress.com\nThis is an example.\nPress Confirm to continue");

10 Simple user interface setup 1.Include the libraries 2.Define the relevant parameters for the hardware, such as pins etc. 3.Define what button output represents what function, such as ‘B’ button means enter ‘U’ button means up. 4.Instantiate objects for different keypad types, including serial port keypad 5.Include all keypad types in an array 6.Initialize the library for use 7.Set up some simple parameters 8.Call library functions to interact with the user. 9.You can also call wait_on_escape(time_ms) to get button pushes from all input devices. 10.You may substitute or simulate button presses with serial port monitor.

11 Initial setup (don’t change)

12 Your code 1 2 3 4 5 5 1.Define some messages and lists 2.Begin the lcd 3.Initialize the phi_prompt library 4.Display a scrollable simple text area 5.Prepare and display a simple select list 6.Respond to user’s choice

13 Bluetooth 1 The optional Bluetooth module acts as a wireless serial port, sending data to a smart phone or tablet. 1.It only needs to be set up once. You need to know ahead of time what baud rate it is using (or guess a few times). 2.You need to set a name to identify your unit. 3.You may change to a new baud rate if needed. 4.Use “AT” to start command mode, wait a bit, then send in new name xxxx with “AT+NAMExxxx”, then wait. 5.This time send in new baud rate x with “AT+BAUDx”. Baud rates:1=1200, 2=2400,… 8=115200. See array values. 3 2 4 5

14 Micro-SD card 1 2 3 4 5 1.Wait for user input before start logging. 2.Initialize the SD card. Pin 10 is the Chip-select pin on the OSPL and some SD shields. 3.Use logfile to open LOGGER00.CSV to write to, create it if it doesn’t exist, append if it does. 4.Wait for user input again before stop logging. 5.The open file must be closed to prevent data loss. One shouldn’t just turn off OSPL when it is logging to SD card. SD logging is made extremely easy with the SdFat library written by William Greiman. You can print to a file just like you can to the serial port. The only difference is that it has a lot more functions than a serial port, such as creating/renaming/deleting files and folders, testing the existence of files and adding date/time call-back functions so the file has meaningful date/time instead of 2000/1/1 12:00am.

15 Standard firmware A list of Vernier sensors and 10DOF sensor board sensors are included One may pause (resume) live display by turning the rotary encoder left (right) One may start (stop) sending data to serial port by turning the rotary encoder to the right (left) Current version has not included SD card functions Also battery voltage sensing is not included yet

16 Revision V 2.2 Fully assembled units will be available A different chip will be used (ATMEGA32U4) No more Arduino Nano daughter board No more jumper to switch between USB serial and Bluetooth. Both will be active with Serial and Serial1. Four DIN-5 plugs, with first 3 having analog/digital I/O pins and the last one with digital I/O and I 2 C pins. Real time clock and battery will be included to log date and time for data acquisition and file creation time Rotary encoder will be connected to digital pins


Download ppt "AAPT workshop W03 July 26, 2014 Saint Cloud State University, MN, USA"

Similar presentations


Ads by Google