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.

103 lines
6.6 KiB

5 years ago
  1. \documentclass[11pt]{article}
  2. %Gummi|065|=)
  3. \usepackage{graphicx}
  4. \usepackage{caption}
  5. \title{\textbf{Air Quality Sensor}}
  6. \author{Steak Electronics}
  7. \date{2018 (revised 2019)}
  8. \begin{document}
  9. \maketitle
  10. \tableofcontents
  11. \section{Overview}
  12. To know when I need to clean my room. I usually vacuum every two or three weeks, but sometimes am lazy and I need a reminder. The dust sensor will be more motivation to get me to clean, when I see the dust levels increase. \footnote{Technically, I also get a rash from excess dust, which is another great motivator.}
  13. \begin{center}
  14. \includegraphics[scale=0.3]{../pics/dustsensor.JPG}
  15. \captionof{figure}{Shinyei Dust sensor PPD42}
  16. \end{center}
  17. \section{Work Log}
  18. \subsection{Parts List}
  19. \begin{itemize}
  20. \item Shinyei PPD42NS Air Quality Sensor
  21. \item MSP-EXP430G2553 V1.5
  22. \item 5V adapter (required as MSP is 3.3V only)
  23. \item SD Card adapter
  24. \item Ethernet Module
  25. \item Energia version 0101E0012 (or later, possibly)
  26. \end{itemize}
  27. \subsection{Beginning}
  28. Here are some things I learned working on this project.
  29. \textbf{IDE}
  30. I'm using Energia from energia.nu which is an Arduino IDE clone for TI Launchpads. This will allow for rapid development. And ease me into the TI platform.
  31. \textbf{MSP-EXP430G2 V1.5}
  32. There are different version of this. My particular board is the
  33. and as explained here: http://energia.nu/pin-maps/guide\_msp430g2launchpad/ and http://energia.nu/pin-maps/guide\_msp430g2launchpad/
  34. You need to rotate the UART jumpers to get UART to display correctly. Oddly enough you can choose a different chip in the boards list and serial will print out right... But switch the jumpers and the correct board will work with UART. Otherwise, it does not work out of the box for serial.print. Though the blink example sketch works.
  35. \textbf{Dust Sensor}
  36. The code for the dust sensor is found online easily. The pinout is tricky as the colours of the wire are nonsense, but the pinout seems to be the same for all sensors, and is: PIN 1 (closest to black box) GND, PIN 3, VDD (5+V), PIN 4 output A. there is also an output B for different readings (I think size) of dust. I'm not that particular (no pun intended) about my dust so I will go with the one most people are using.
  37. \textbf{3.3V only on TI}
  38. The TI takes input of USB but only outputs 3.3V. Fail. I'll through a 5V PSU on the board. It won't be connected to USB for its use anyways.
  39. \textbf{POW function}
  40. There is a pow function (power exponent) in arduino. In TI, I changed it to powf, and included math.h.
  41. I'm not sure if my change was correct.
  42. EDIT: looks like there is a LED tied to pin 14. I'm moving to pin 13. I meant to use 13 earlier but accidentally used the wrong pin and kept using it. Oops.
  43. EDIT 2: Actually, I was reading from the wrong pin in software. Maybe I will leave it on the LED pin as you can see when the dust is firing off the sensor. Hm.... Neat.
  44. EDIT 3: Yes, so I had to use powf instead of pow, and it works. The accidental incorrect pin was a bonus as it allows me to see visually how often the sensor is going off. Over time, I should have a vague grasp of the dust levels just looking at the light. Actually, I won't. Nevermind. The dust sensor reading, is too irregular for that.
  45. \subsection{Work Log 08/2018}
  46. I've put everything on a single piece of plywood, and need to do some more work on the code. I've decided to forgo the SD card, as I don't want to deal with reading a 2MB sd card with the buffer provided by the SRAM. I'm not quite sure how to manage that, and whether it's possible to read such large data files. I did some quick research and did not find what I wanted. It is likely possible, but let's do something simpler. Instead, I will use the EEPROM to store the last 5 minutes of data or so, and then have the server read the data every five minutes. This keeps the client simple, and puts the burden of complexity on the server.
  47. In addition, I don't want to read SD cards manually, as that is cumbersome, though possibly scripts could be made.
  48. The PPD42 was made sure to be put vertically.
  49. \begin{center}
  50. \includegraphics[scale=0.3]{../pics/woodboard.JPG}
  51. \captionof{figure}{Everything on a piece of plywood, is a nice presentation. Sand and finish with urethane as well.}
  52. \end{center}
  53. \subsection{Work Log 12/2018}
  54. I have decided to change how I do this slightly. Instead of an SD card, I will connect on the LAN and use thingspeak from a locally hosted instance (and deployed with docker, possibly) or some other aggregating server to pull the data. I'll also make a shield, to simplify deployment. That might not be necessary, but I can make a shield in a few hours, and pcbs are cheap. These options such as thingspeak sometimes have graphing / plotting included.
  55. I'm going to use this library:
  56. https://github.com/reaper7/EtherEncLib/releases
  57. so git clone that, then
  58. git tags -l
  59. git checkout tags/v0.4.2
  60. to get the latest release (or a newer one if possible).
  61. The pinout for the ENC is viewable at the figure to the right. This is from the 43oh.com forum.
  62. \footnote{You will see later, that this library turns out to be not developed enough, and results in overall failure for this project. Next time, use a well vetted library!}
  63. \subsection{PCB Layout}
  64. Layout is simple for the most part. I again, flipped the ENC as I had done on the Uno board, so it is inserted upside down on the board. This time I went only with the 2x5 pin enc for simplicity sake. The shield is below the MSP, so longer pin headers will be used (already have those) to give space for the barrel plug. The board needs a 3.3v regulator and 5v for the PPD42. To get the sizing of the shield right, I aligned my grid with that of the design files for the msp430 dev board, and made sure the spacing between the 0.1” headers was exactly the same – easy. Ran all traces of 20 mils and made the board small as reasonably possible. Now to get them made, and actually test this.
  65. \subsubsection{Aligning shield with Eagle and KiCad}
  66. So here was an interesting segway. I had design files in Eagle, and I wanted to make a shield for the MSP in Kicad. What I did, was align the grid in Eagle, to be the same as Kicad, and then as appropriate, sized points on the Kicad grid to fit exactly where the MSP shield was. In fact, it turned out 100\% correct the first try. Here is where FOSS and OSHW worked out well. Without the design files (say if I had only a PDF with some measurements), I can't say it would've turned out as well. Open file formats for all components and shields!
  67. \begin{center}
  68. \includegraphics[scale=0.5]{../pics/pcblayout.jpg}
  69. \captionof{figure}{See caption on picture.}
  70. \end{center}
  71. \subsection{}
  72. \end{document}