Testing out the PPD42 Air Quality Sensor, with an MSP430 Launchpad and graphing the data with GNUplot.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
5.1 KiB

5 years ago
  1. Thu Jan 18 15:59:35 MST 2001 removed jcl references for rxtx 1.5 Trent.
  2. The Following was contributed by Vaibhav Andleigh andleigh@mit.edu in hopes
  3. that it will make getting started easier for people new to commAPI.
  4. Feel free to contribute additional information in the same spirit.
  5. Hi Trent,
  6. I recently installed javax.comm and RxTx on a few systems and had to write
  7. a very detailed HOWTO on read/writing to your com ports on linux for
  8. beginners. BTW, RxTx is a great tool! In any case, I've included the
  9. HOWTO with this email for the reference of other users. Feel free to post
  10. it.
  11. ------------------------
  12. SerialPortInstructions.txt
  13. To get serial port stuff running:
  14. Serial Connection without Java
  15. First, let's setup the serial connection without java and test it.
  16. Connect your computer to another computer/device via a null modem serial
  17. cable. Be sure the other computer/device has software (i.e., minicom)
  18. to receive the signal. For the purpose of these instructions, I'll
  19. assume you have a computer at each end, and will use minicom to
  20. perform the connection testing.
  21. In the case of minicom (on the receiving machine), you'll probably have
  22. to run it as root (since the serial port is owned by root for security
  23. purposes). It's not a good idea to change these permissions. If this
  24. is the first time minicom is being run, you'll have to configure it
  25. first. To do this, ssh to root (not su, anywhere in these instructions)
  26. and type 'minicom -s' without the quotes. Arrow to option 3 and change
  27. the serial configuration device to '/dev/ttyS0' without the quotes.
  28. Exit minicom. Then go and run minicom by typing 'minicom -m -c on'
  29. without the quotes. Assuming you're running minicom on both machines,
  30. run a quick test of the serial connection. Type Alt-Z (or whatever
  31. key-combo gives you help on special keys) and select "Local Echo"(E).
  32. Now type text on both minicom screens and see that the text is going
  33. back and forth.
  34. Java.comm and RxTx installation
  35. First install javax.comm api following Sun's instructions
  36. Be sure to follow the instructions about placing the comm.jar
  37. in the correct directories. You can ignore the details of
  38. the javax.comm.properties files since it'll be replaced by RxTx
  39. anyways.
  40. Then install rxtx-1.4-4 following instructions given in
  41. their install page. They have a really useful bit of info
  42. in the INSTALL file talking about where the comm.jar,
  43. javax.comm.properties files(and its contents) are supposed to go
  44. (and what other files (libSerial.so and libParallel.so)should
  45. have been created and where). Verify this happened properly.
  46. Assuming you're using jdk-1.2, you can ignore the CLASSPATH
  47. stuff in their extra directions. If you still have problems, they
  48. have a really useful COMMON PROBLEMS section further down in the
  49. INSTALL file.
  50. Running Trial Applications
  51. We'll test two apps: BlackBox and the Simple demos. These are
  52. included in your .../java/commapi/samples directory. Go to
  53. .../java/commapi/samples/BlackBox/ and type javac *.java to compile
  54. all the classes.
  55. Then create a run shell script as follows (substitute your own relative
  56. java location if necessary):
  57. runBlackBox.sh
  58. #!/bin/sh
  59. /usr/local/java/bin/java -classpath
  60. ./:/usrlocal/java/jre/lib/ext/comm.jar:/usr/local/java/samples/BlackBox/BlackBox.jar
  61. BlackBox
  62. Run this script as ROOT using ssh, not su!
  63. [or make sure permissions for the device files allow the user/group to read
  64. them. See also: lockfiles in INSTALL]
  65. It should put up a screen with a GUI of everything going on for each
  66. of your serial ports. At the top of the screen, you can set the baud
  67. rate. Unless you changed the settings on minicom, it should be expecting
  68. 38400 so select that. Go ahead and type in the first left text window
  69. and you should see the text appear in the receiving minicom window.
  70. If you choose to run the apps labeled as "Simple", go to the
  71. .../java/commapi/samples/Simple/ directory and edit the SimpleWrite.java
  72. and SimpleRead.java files. Convert the /dev/tty/a to /dev/ttyS0 in both
  73. files. Compile both files using javac *.java . Use a run script very
  74. similar to that above (deleting the path reference to BlackBox.jar and
  75. replacing BlackBox with SimpleRead/SimpleWrite as appropriate).
  76. Set up minicom on the other machine and go ahead and run the script.
  77. It should all work. I've attached the run scripts I used for both
  78. programs below:
  79. runSimpleRead.sh
  80. #!/bin/sh
  81. /usr/local/java/bin/java -classpath
  82. ./:/usrlocal/java/jre/lib/ext/comm.jar
  83. SimpleRead
  84. runSimpleWrite.sh
  85. #!/bin/sh
  86. /usr/local/java/bin/java -classpath
  87. ./:/usrlocal/java/jre/lib/ext/comm.jar
  88. SimpleWrite
  89. **********************************************
  90. Vaibhav Andleigh
  91. andleigh@mit.edu
  92. http://utopia1.mit.edu/vab/
  93. ------------------------------------------------------
  94. Ph.D. Student, Dept. Mat. Sci. & Engr
  95. MIT Room 13-5142 Ph: 617-258-8847
  96. Cambridge, MA Fax: 530-348-8219
  97. **********************************************
  98. "Every man dies, not every man really lives."
  99. --William Wallace, Braveheart