Presentation on theme: "Arduino Real Time Data The Mission is to monitor an electronic test bench to include: Read/Display 16 analog values. Read/Decode 14 Digital pin bus for."— Presentation transcript:
1Arduino Real Time DataThe Mission is to monitor an electronic test bench to include:Read/Display 16 analog values.Read/Decode 14 Digital pin bus for clock control.Read/Write a 32 bit bus by nibbles.Generate a data logView/Interact via a PC.Display bench (BOX) values on a LCD display and PC.Add WiFi via BT_BOARD V1.04.PLX-DAQ: (Works but it’s Limited).p Getting Setup files and brief over view of PLX-DAQ.p Arduino source code and notes concerning same.p Excel data sheet containing VB code allowing Arduino data acquisition.PROCESSING:p Arduino and processing: set-up files, Arduino & P2 source code.p Changing the 32bit data bus.p Generating real time log file.p Excel data sheet generated (log file).p Collection of Arduino Ports used and plan to include LCD display.p Details on the SPLC780D LCD display, Arduino LCD code to drive it.P Tying 74LS164 shift register to Arduino.p Recap of ports used and program references.p Use of BT_BOARD v1.04.p LS157 DataSheet & 74LS164 DataSheetp More Stuff: Collection of notes.1
2PLX-DAQ Set-Up: Getting Necessary Files Download Arduino Mega2560:Download Arduino Processing:Note: This was done but not employed. Firmata DB was for UNO.Download PLX-DAQ:Blog on PLX-DAQ-n-Arduino:Brief PLX-DAQ Code Used in Arduino Sketches. I think this all of it:LABLE Used to define the column headings.Syntax: Serial.println (“LABEL, INT_COLUMN”);DATE, TIME - Allows the serial port to send data to Excel.Syntax: Serial.print (“DATE, TIME,”); Serial.println (val);Note: Serial.print (“DATE, TIME,”) must be used beforeeach Serial.println();ROW, SET, k, - This allows control over the row that excel accepts data.Syntax: Serial.println(ROW, SET, #);The column control: Serial.print(“,”) ; Like CSV
3Short Ardunio Script Placing Arduino Reads into Excel Meter Open Document TextDouble click to open, 233 line sketch, reading analog pins A(15:0] and sending it to ECEL. Need win2k or better.14 bit decode of up/dwn counters to display CLK, and write A5A5 to nibs 7:4 and read that into nibs 3:0.Use bench_mon.xlsm found in PLX-DAQ.NOTES:The Arduino code writes to columns 1-3 (A-C) and ECEL maps columns B to G and to C to I .Column A is the “DATA, TIME, “ This is needed to have EXCEL read the incoming data.8 Nibs can be read or written: pic shows a write of A5A5 and reading same. The value to R/W is CSV file read by script.The frequency will be the decode of up/down counters used to generate CLOCK with base frequency of either 10 or 20 MHZ crystal module and I really need the “BOX” to finish this.Reads of 12 analog ports with wait of 5mS B/W reads plus40mS at end of reads allows about 10 reads/s.The box colors are based on the data received , set in EXCEL.Supply : 0<=5V consider a 5% de-rating.Supply >5v are a 10% de-rating.All values read outside their de-rating show RED.The voltages monitored were 5V, 3.3V and 0V and the one pot V- OUT seen in the V-V supply where the color green/red was base on value V>= 0 = green and anything else is red.All current values were tied to 0V where = green andany measurement above or below this range is red.The Measured value has no constraints and will always be green.Must! open xcel to blank sheet. Connect to data port thenmove meter sheet to first page (blank out Meter).ECEL SnapshotSupplies5V5.00V0.00mA12V3.44V-V2.26N12V4.99MeasuredA1-2A3-4A5-6A7-8Main ClockBASE10.00MHZCLK813.74HZNIBS [15:0]Data R-HA5Data W
4EXCEL Data Sheet UsedThis is the excel DB used. The DATE,TIME, field A1 , measured value 1-2=B2-3.You must use the downloaded excel worksheet it contains VB code that allows Arduino access, or this one. Sheet : bench_mon2.xlsm.
5ARDUINO & PROCESSINGDownload Processing: Download Arduino Processing: Copy folder Arduino to processing folder C:\downloads\processing windows32\processing-2.0.1\modes\java\libraries Enter processing and add font: “Arial-BoldMT-14”, <Tools><Create Font> Add sketch box_proc_pde.txt making the box.Add patch to Arduino IDE.See More Stuff: ending pgs..Click R-W to change the 32 bit bus status.Click Log to allow data log.
6Change The 32 Bit BusThe meter will default to all read: r,r,r,r,r,r,r,r . Click R-W and the box below will pop-up, make your entry and click OK. The board is currently wired upper 2 bytes to the lower 2 bytes, so it will read what it writes.
7Data LogClick the Log button and the box below will pop-up suggesting a file name of the current date and time.Accept it or change to your preference. This will write out a CSV file containing the measurements and settings of the box.
9The Box Settings and Ports used, also the plan to include SPLC870D LCD Display
10SPLC780D/74LS1641161718Arduino source code driving LCD. Lcd2 uses on change writePin/Signal Wire1 DB Blue Solid2 DB Blue Striped3 DB Brown Solid4 DB Brown Striped5 DB Blue Solid6 DB Blue Striped7 DB Brown Solid8 DB Brown Striped9 E Blue Solid10 R/W Blue Striped11 RS Green Solid12 V Green Striped13 VSS Green Striped& Solid14 VDD Orange Solid15 E Orange Striped16 NC17 LEDA Orange Solid18 LEDK Green SolidConnectorDB DB7DB DB5DB DB3DB DB1R/W E1V RSVDD VSSNC E2SPLAC780D DATA SHEETS17 LEDA 5V18 LEDK GND
11SPLC780D HOOK-UP RAILS 5V GND VO, Was Designed to tie through a 10k pot to GND.R/W=0=Write; RS=0=INSLEDA 5VLEDK GND116171874LS16416-R_S21-E120-E219-R_W18-D_I17-CKArduino pins used as digital outputs:D[21:16] .DB DB6DB DB4DB DB2DB DB0E R/WRS VOVSS VDDE NC
12Free-up RX/TX3 To Include BT_BOARD V1.04 RAILS5VGND11718LEDA 5VLEDK GND16-R_S19-ER/W16¼ 74LS1572:1E2Arduino pinsused as digital outputs:D[19:16] .E1DB DB6DB DB4DB DB2DB DB0E R/WRS VOVSS VDDE NC2:174LS16418-D_I17-CKVO, Was Designed to tie through a 10k pot to GND.R/W=0=Write; RS=0=INS12
14PORTS/PINS/PROGRAM_VAR_NAME See p.11, 6 pin LCD See p.12, 4 pin LCDArduino Data SheetThe PDF file is huge! 8g so it was removed and replaced by the pointer above.
15BT_BOARD V1.04Industrial serial port Bluetooth, Drop-in replacement for wired serial connections, transparent usage.You can use it simply for a serial port replacement to establish connection between MCU and GPS,PC to your embedded project and etc.Computer and peripheral devicesGPS receiverIndustrial controlMCU projects Default serial port setting : Pairing code : 1234Running in slave role: Pair with BT dongle and master moduleUsageCoupled Mode: Two modules will establish communication automatically when powered. PC hosted mode: Pair the module with Bluetooth dongle directly as virtual serial.Bluetooth protocol : Bluetooth Specification v2.0+EDR Frequency : 2.4GHz ISM band Modulation : GFSK(Gaussian Frequency Shift Keying) Emission power : <=4dBm, Class 2 Sensitivity : <=-84dBm at 0.1% BER Speed : Asynchronous: 2.1Mbps(Max) / 160 kbps, Synchronous: 1Mbps/1Mbps Security : Authentication and encryption Profiles : Bluetooth serial portCSR chip : Bluetooth v2.0 Wave band : 2.4GHz-2.8GHz, ISM Band Protocol : Bluetooth V2.0 Power Class : (+6dbm) Reception sensitivity: -85dBm * Voltage : 3.3 (2.7V-4.2V) ** NOT CORRECT Current : Paring - 35mA, Connected - 8mA Temperature : -40~ +105 Degrees Celsius User defined Baud rate : 4800, 9600, 19200, 38400, 57600, , ,460800,921600, Dimension : 26.9mm*13mm*2.2mm* Correspondence with seller:VCC < 7VIf VCC = 5V then RX/TX willachieve TTL 5V levels.
16BT_BOARD V1.04Pin definition : PIO8 connects with LED cathodea with 470ohm series resistor in between. LED NEGATIVE connects to ground. It is used to indicate the module state. After powered on, flashing intervals differ in different states. PIO9 is used to control LED indicating paring. It will be steady on when paring is successful. PIO11, module state switching pin. HIGH -> response to AT command; LOW or floating -> regular work status. With build-in reset circuit, reset is completed automatically after powered on. Steps to set to MASTER: Set PIO11 HIGH with a 10K resistor in between. Power on, module comes into AT Command Response Status Open HyperTerminal or other serial tool, set the baud rate 38400, 8 data bits, 1 stop bit, no parity bit, no Flow Control Via serial port, send characters "AT + ROLE = 1 r n", if successful, return "OK r n", where r n is carriage return. Set PIO11 LOW, re-power, then in Master state, automatically search for slave module and connect.16
19Some Extra StuffP.5 Arduino & Processing . Add Patch to allow String2Float and Float2String conversion.See blogReplace C:/Program Files/Arduino/hardware/arduino/cores/arduino/Wstring.[h,cpp] with those from site.String example1 = String(1.852); // Equals: " " example1 = String(1.852, 2); // Equals: "1.85"String example2 = String(example1.toFloat() * , 4); // Equals: "3.3014" example1 = example ; // Equals: " ", since the example2 variableis of type String the number gets converted into String and concatenated.This is patch for Arduino releases. The next releases from Arduino are 1.5.# not yet made public.This was an attempt to make writes more stable, however; it behaved the same.The PLX-DAQ works well but does not allow any other interaction than reporting collected data. It’s fast and easily but limited.The current LCD display is power starved (driven by USB). Once better rails are applied POTS will be added to VO and A-K, allowingVariable back light intensity and the correct contrast. This will sharpen the LCD appearance.Will use 6 pins digital P16-21, which will drive LS74164 and SPLC780d. The E[2:1] and RW connections are not necessary; addingvarious external logic will eliminate E[2:1] and RW is always tied LOW, write. Change to 4 pin interface, p.12 .The LCD has 2 font capabilities 5x10 & 5x7 ;how ever, only the 5x10 display can be chosen. I also had problem selecting thedesired cursor control. Wanted to just move cursor to a given address and write backwards (w/o shifting the display). This wouldhave made printing to LCD cleaner, all values to LCD and PC are String values and keeping decimal place works best right to left.I was able to set up close to this but cursor movement is left to right.The need to write to specific locations allows print on change and also a non-flashy display. The LCD display looks just like theProcessing BOX on the PC just not quite as fast.Future plan is to add another MEGA to work in tandem as both master and slave Would like to control clock frequency based ondata, as well as alter PWM to several servo’s based on data. Not yet clear but RX/TX3 can readily be reassigned and the 32 bit busmay also play a role B/W the two. I’m leaning toward receiving info via the digital write to the LCD and possible returning infovia RX/TX3.
20More StuffWill eliminate Arduino’s pin 19, program name E which drives the LCD capture clock. Using a counter clocked by CK, a count of 8 will clock E. TTL logic74LS163 a 4 bit binary counter and will be decoded by 8. May seem asynchronous but not, it’s in correct time frame.