8 Commits

Author SHA1 Message Date
Ricardo
2e69d77f62 Changing project from Monitor to Simulator. 2018-02-22 21:37:32 +00:00
Ricardo
a0df87906b Fixed reading from rs-422 to usb. 2018-02-22 20:44:40 +00:00
Ricardo
7401853115 Working on reading serial. 2018-02-13 22:29:30 +00:00
Ricardo
95adfe3c87 Added adafruit GPS library. 2018-02-12 22:50:13 +00:00
Ricardo
ddf549d91c Fixed label pinout on nmea connector. 2018-02-10 15:47:54 +00:00
Ricardo
c33e05900f Working on reading serial, RX- on pin 1 of rs422 header. 2018-02-08 22:52:04 +00:00
Ricardo
cba4dd309f Lost on read serial. 2018-02-07 22:31:47 +00:00
Ricardo
31ebbafea0 Transmitting GPS successfull. Working on reading nmea. 2018-01-31 23:01:55 +00:00
5 changed files with 2108 additions and 2135 deletions

View File

@@ -6,8 +6,8 @@ EESchema-LIBRARY Version 2.3
DEF +3V3 #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "+3V3" 0 140 50 H V C CNN
F2 "" 0 0 50 H V C CNN
F3 "" 0 0 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
ALIAS +3.3V
DRAW
P 2 0 1 0 -30 50 0 100 N
@@ -67,14 +67,10 @@ ENDDEF
DEF C C 0 10 N Y 1 F N
F0 "C" 25 100 50 H V L CNN
F1 "C" 25 -100 50 H V L CNN
F2 "" 38 -150 50 H V C CNN
F3 "" 0 0 50 H V C CNN
F2 "" 38 -150 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
C?
C_????_*
C_????
SMD*_c
Capacitor*
C_*
$ENDFPLIST
DRAW
P 2 0 1 20 -80 -30 80 -30 N
@@ -195,8 +191,8 @@ ENDDEF
DEF Crystal Y 0 40 N N 1 F N
F0 "Y" 0 150 50 H V C CNN
F1 "Crystal" 0 -150 50 H V C CNN
F2 "" 0 0 50 H V C CNN
F3 "" 0 0 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Crystal*
$ENDFPLIST
@@ -216,10 +212,10 @@ ENDDEF
DEF FT232RL U 0 40 Y Y 1 F N
F0 "U" -650 900 50 H V L CNN
F1 "FT232RL" 400 900 50 H V L CNN
F2 "SSOP-28" 0 0 50 H V C CNN
F3 "" 0 0 50 H V C CNN
F2 "Housings_SSOP:SSOP-28_5.3x10.2mm_Pitch0.65mm" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
SSOP*
SSOP*5.3x10.2mm*Pitch0.65mm*
$ENDFPLIST
DRAW
S -650 850 650 -850 0 1 10 f
@@ -257,8 +253,8 @@ ENDDEF
DEF GND #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -250 50 H I C CNN
F1 "GND" 0 -150 50 H V C CNN
F2 "" 0 0 50 H V C CNN
F3 "" 0 0 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N
X GND 1 0 0 0 D 50 50 1 1 W N
@@ -287,8 +283,8 @@ ENDDEF
DEF Jumper_NO_Small JP 0 30 N N 1 F N
F0 "JP" 0 80 50 H V C CNN
F1 "Jumper_NO_Small" 10 -60 50 H V C CNN
F2 "" 0 0 50 H V C CNN
F3 "" 0 0 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
C -40 0 20 0 1 0 N
C 40 0 20 0 1 0 N
@@ -302,11 +298,13 @@ ENDDEF
DEF L L 0 40 N N 1 F N
F0 "L" -50 0 50 V V C CNN
F1 "L" 75 0 50 V V C CNN
F2 "" 0 0 50 H V C CNN
F3 "" 0 0 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Choke_*
*Coil*
Inductor_*
L_*
$ENDFPLIST
DRAW
A 0 -75 25 -899 899 0 1 0 N 0 -100 0 -50
@@ -323,8 +321,8 @@ ENDDEF
DEF LED D 0 40 Y N 1 F N
F0 "D" 0 100 50 H V C CNN
F1 "LED" 0 -100 50 H V C CNN
F2 "" 0 0 50 H V C CNN
F3 "" 0 0 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
LED*
$ENDFPLIST
@@ -379,11 +377,11 @@ ENDDEF
DEF R R 0 0 N Y 1 F N
F0 "R" 80 0 50 V V C CNN
F1 "R" 0 0 50 V V C CNN
F2 "" -70 0 50 V V C CNN
F3 "" 0 0 50 H V C CNN
F2 "" -70 0 50 V I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
R_*
Resistor_*
R_*
$ENDFPLIST
DRAW
S -40 -100 40 100 0 1 10 N
@@ -397,8 +395,8 @@ ENDDEF
DEF SW_Push SW 0 40 N N 1 F N
F0 "SW" 50 100 50 H V L CNN
F1 "SW_Push" 0 -60 50 H V C CNN
F2 "" 0 200 50 H V C CNN
F3 "" 0 200 50 H V C CNN
F2 "" 0 200 50 H I C CNN
F3 "" 0 200 50 H I C CNN
DRAW
C -80 0 20 0 1 0 N
C 80 0 20 0 1 0 N

View File

@@ -1406,9 +1406,9 @@ Wire Wire Line
Wire Wire Line
10825 8525 10975 8525
Text Notes 12400 7275 0 60 ~ 0
RX+
RX+ / B
Text Notes 12400 7375 0 60 ~ 0
RX-
RX- / A
Text Notes 12400 7575 0 60 ~ 0
TX- / A
Text Notes 12400 7475 0 60 ~ 0

View File

@@ -31,6 +31,7 @@ LIBS:contrib
LIBS:valves
LIBS:ftdi
LIBS:switches
LIBS:electropepper_kicad
LIBS:nmm1-cache
EELAYER 25 0
EELAYER END
@@ -1406,13 +1407,13 @@ Wire Wire Line
Wire Wire Line
10825 8525 10975 8525
Text Notes 12400 7275 0 60 ~ 0
RX+ / B
RX- / B
Text Notes 12400 7375 0 60 ~ 0
RX- / A
RX+ / A
Text Notes 12400 7575 0 60 ~ 0
TX- / A
TX+ / A
Text Notes 12400 7475 0 60 ~ 0
TX+ / B
TX- / B
NoConn ~ 10575 4575
NoConn ~ 10575 4475
Wire Wire Line

View File

@@ -1,2 +1,2 @@
# NMEA Monitor 1
A small portable NMEA0183 comunications monitor.
# NMEA Simulator 1
A small portable NMEA0183 comunications simulator.

View File

@@ -1,15 +1,15 @@
/*********************************************************************
NMM-1
NMEA0183 serial monitor.
NMEA0183 serial simulator.
By Jony Silva
Wed 24 Jan 23:11:25 GMT 2018
*********************************************************************/
// Libraries to be included
//#include <SPI.h>
//#include <Wire.h>
#include <SPI.h>
#include <Wire.h>
#include <SoftwareSerial.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
@@ -40,10 +40,9 @@ Adafruit_SSD1306 display(OLED_RESET);
void one(); // Menu one
void two(); // Menu two
void three(); // Menu three
void four(); // Menu four
void read_serial(); // Menu that reads the serial
void write_serial(); // Menu that writes to serial
void config(); // Configuration menu
void config_nmm(); // Configuration menu
void batt_icon(); // Draws the battery icon acording to value
@@ -55,6 +54,13 @@ int OK_state = OFF; // Holds state for OK, either ON or OFF
int DOWN_state = OFF; // Holds state for DOWN, either ON or OFF
int CANCEL_state = OFF; // Holds state for CANCEL, either ON or OFF
int batt_val = 0; // Holds the value of battery voltage
int incomingByte; // Serial incoming byte buffer
int lines = 0;
int chars = 0;
char sentence[68];
String s;
int i;
int read_s = 0;
// Create SoftwareSerial object and designate pins
@@ -62,7 +68,7 @@ int batt_val = 0; // Holds the value of battery voltage
void setup() { // BEGIN SETUP ------------------------------------
// Configure buttons and led's has inputs or outputs
pinMode(led1, OUTPUT); // Led 1 is an output
pinMode(led2, OUTPUT); // Led 2 is an output
pinMode(UP, INPUT); // Switch 1 is an input
@@ -70,13 +76,14 @@ void setup() { // BEGIN SETUP ------------------------------------
pinMode(DOWN, INPUT); // Switch 3 is an input
pinMode(CANCEL, INPUT); // Switch 4 is an input
// Define the starting state of the led's
digitalWrite(led1,HIGH); // Turn off led 1
digitalWrite(led2,HIGH); // Turn off led 2
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
// set the data rate for the Serial port
Serial.begin(4800);
// by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32)
@@ -104,7 +111,7 @@ void setup() { // BEGIN SETUP ------------------------------------
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(36,12);
display.setCursor(36,22);
display.println("NMM-1");
display.display();
delay(3000);
@@ -126,10 +133,7 @@ ISR(TIMER1_COMPA_vect) //
menuState = 1;
}
else if (menuState == 3) {
menuState = 4;
}
else if (menuState == 4) {
menuState = 1;
menuState = 2;
}
while (!rUP); // Check if button is still pressed do nothing
}
@@ -145,9 +149,6 @@ ISR(TIMER1_COMPA_vect) //
else if (menuState == 3) {
menuState = 3;
}
else if (menuState == 4) {
menuState = 3;
}
while (!rDOWN); // Check if button is still pressed do nothing
}
@@ -165,10 +166,6 @@ ISR(TIMER1_COMPA_vect) //
menuState = 12;
prevMenu = 3;
}
else if (menuState == 4) {
menuState = 11;
prevMenu = 4;
}
while (!rOK); // Check if button is still pressed do nothing
}
@@ -183,9 +180,6 @@ ISR(TIMER1_COMPA_vect) //
else if (prevMenu == 3) {
menuState = 3;
}
else if (prevMenu == 4) {
menuState = 4;
}
while (!rCANCEL); // Check if button is still pressed do nothing
}
}
@@ -197,42 +191,59 @@ void loop() {
batt_val = analogRead(batt);
// Routine to check the battery analog value for calibration
/* display.drawRect(0, 8, 168, 24, BLACK);
display.display();
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(50,18);
display.println(batt_val);
batt_icon();
display.display();*/
if (menuState == 1) {
one();
mySerial.end();
read_s = 0;
}
else if (menuState == 2) {
two();
mySerial.end();
read_s = 0;
}
else if (menuState == 3) {
three();
}
else if (menuState == 4) {
four();
mySerial.end();
read_s = 0;
}
else if (menuState == 10) {
if (read_s == 0) {
mySerial.begin(4800);
read_s = 1;
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(1,17);
display.println("RS-422 to USB");
display.println("Sending...");
batt_icon();
display.display();
}
read_serial();
}
else if (menuState == 11) {
write_serial();
if (read_s == 0) {
mySerial.begin(4800);
read_s = 1;
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(1,17);
display.println("Sending GPS.....");
batt_icon();
display.display();
}
write_serial();
}
else if (menuState == 12) {
config();
config_nmm();
mySerial.end();
read_s = 0;
}
else {
one();
mySerial.end();
read_s = 0;
}
}
@@ -295,100 +306,64 @@ void batt_icon (void) {
void one (void) {
display.drawRect(0, 8, 168, 24, BLACK);
display.display();
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(1,12);
display.println("Read NMEA0183 <--");
display.setCursor(1,22);
display.println("Write NMEA0183");
batt_icon();
display.display();
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(1,12);
display.println("RS422 ==> USB <--");
display.setCursor(1,22);
display.println("Send NMEA0183");
display.setCursor(1,32);
display.println("Config NMEA0183");
batt_icon();
display.display();
}
void two (void) {
display.drawRect(0, 8, 168, 24, BLACK);
display.display();
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(1,12);
display.println("Read NMEA0183");
display.setCursor(1,22);
display.println("Write NMEA0183 <--");
batt_icon();
display.display();
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(1,12);
display.println("RS422 ==> USB");
display.setCursor(1,22);
display.println("Send NMEA0183 <--");
display.setCursor(1,32);
display.println("Config NMEA0183");
batt_icon();
display.display();
}
void three (void) {
display.drawRect(0, 8, 168, 24, BLACK);
display.display();
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(1,12);
display.println("Write NMEA0183");
display.setCursor(1,22);
display.println("Config NMEA0183 <--");
batt_icon();
display.display();
}
void four (void) {
display.drawRect(0, 8, 168, 24, BLACK);
display.display();
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(1,12);
display.println("Write NMEA0183 <--");
display.setCursor(1,22);
display.println("Config NMEA0183");
batt_icon();
display.display();
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(1,12);
display.println("RS422 ==> USB");
display.setCursor(1,22);
display.println("Send NMEA0183");
display.setCursor(1,32);
display.println("Config NMEA0183 <--");
batt_icon();
display.display();
}
void read_serial (void) {
display.drawRect(0, 8, 168, 24, BLACK);
display.display();
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(1,17);
display.println("Lets Read :)");
batt_icon();
display.display();
if (mySerial.available()) {
Serial.write(mySerial.read());
}
}
void write_serial (void) {
display.drawRect(0, 8, 168, 24, BLACK);
display.display();
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(1,17);
display.println("Lets Write :)");
batt_icon();
display.display();
mySerial.print("$GPGGA,090000.10,6350.37829338,N,02225.18272240,W,1,05,2.87,160.00,M,-21.3213,M,,*64");
mySerial.println();
}
void config (void) {
void config_nmm (void) {
display.drawRect(0, 8, 168, 24, BLACK);
display.display();
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
@@ -396,5 +371,4 @@ void config (void) {
display.println("BLOCKED");
batt_icon();
display.display();
}