meetjestad / mjs_pcb

Other
6 stars 0 forks source link

Improvements for v3 #2

Open matthijskooijman opened 7 years ago

matthijskooijman commented 7 years ago

First prototype:

For later:

Disregarded:

matthijskooijman commented 5 years ago

Support for dust sensor? https://sensing.honeywell.com/HPMA115S0-XXX-particle-sensors or SDS-11?

matthijskooijman commented 5 years ago

Maybe use a bigger atmel chip for a bit more flash & ram? Though it seems the only bigger chips also have a bigger pin count (e.g. 644PA and 1284P) and a wider chip. The new PCB size should be around 56mm (to fit in the casing), while the DIP-40 package is just under 53mm, so it would fit neatly..

The 328PB also seems interesting (version of the 328P with extra UARTs, SPI, etc, but it seems there is no DIP version of it....).

matthijskooijman commented 5 years ago

Maybe we could add V-USB for programming? That certainly requires more flash.

We want to add the option to add a piggypack pcb later, for:

matthijskooijman commented 5 years ago

Seems that V-USB needs at least 12Mhz, so that precludes the internal oscillator on most chips (though it seems some chips have a PLL to allow doubling the oscillator frequency, and can even calibrate it to the USB SOF messages, such as the attiny45 used in this examplle).

There are bootloaders available that use V-USB. Most of them need custom drivers on the host, but it seems USBAspLoader emulated an USBAsp AVR programmer and can thus be used through avrdude without additional complexity. It does seem like there has been no development for years, though (github does have some versions where people added a few patches, but nothing official).

Or perhaps we can add a self-built USB-to-serial on the piggypack using some attiny instead? Then this V-USB-based CDC-ACM stack might be useful: http://www.recursion.jp/prose/avrcdc/

Using a V-USB-based bootloader does need more flash, USBAspLoader documents needing a 2k bootloader area (we use 512 bytes for optiboot now, I believe). In addition to the bootloader, the main sketch will also need a similar amount of flash to implement USB (rather than hardwareserial) for logging.

matthijskooijman commented 5 years ago

For improving the connectors, the Molex KK254 series seems promising and commonly used. These have both board-to-board and wire-to-board options. Figuring out what connectors are available exactly is a bit tricky. The overview page has a general overview (with a useful PDF under More Info). On RS-online, there is a "line drawing" PDF available for different subseries, which contains a more detailed mapping of the product numbers to the related drawings and options (but this mapping seems to be somewhat irregular, not all numbers are built in the same way, so the line drawing PDF maps these product numbers ("material no" in the PDF) to "Engineer numbers", which reflect the specs completely.

The KK 254 - 4455 series of board-mounted sockets (that accept regular pin headers, or specific KK254 headers with a vertical plastic tab) seems particularly promising. There are angled sockets with hooks that hook around the board edge, There are vertical sockets which are a bit wider than the default single line sockets, giving them more stability (these have the same hooks as the angled versions, which are not really useful here). Also, there is a "bottom entry" version, which is mounted on the bottom on the PCB, where the pin header of the sensor board would connect through the board, giving a very low-profile connection. RS seems to have these with different contact mechanisms (standard and "Cat ears", which I think refer to the mechanism that the sockets use to clamp the pins inside the socket, cat ears is probably better in some way, but also more than twice as expensive). Molex also offers different contact plating, but it seems RS does not. Farnell has a far more limited selection of these connectors, btw.

I also noticed the KK254 - 44812 series, which has a low profile socket, where the socket is on top of the board, but the pins of the header that is plugged in extend through the board as well.

I'll order a few of these to see how they work.

matthijskooijman commented 5 years ago

Note that grove connectors are officially "NSTech 1125" connectors, but you cannot find these in any store. Digikey does sell "grove connectors", which come from Seeed: https://www.digikey.com/product-detail/en/seeed-technology-co-ltd/110990030/1597-1082-ND/5482560 and https://www.digikey.ca/product-detail/en/seeed-technology-co-ltd/110990037/1597-1083-ND/5482561

matthijskooijman commented 5 years ago

The SDS011 sensor uses a JST XH connector (2.54mm). The sensor has an 8-pin connector (with documented pinout) but often the SDS011 is shipped with an USB-to-serial with a 5-pin JST XH connector and a converter cable (with, to me, unknown pinout). Using the 8-pin connector on the MJS board makes it easy to just order some straight cables, but using a 5-pin connector makes it easier to reuse existing cables. One other alternative is to use a 4-pin connector (we only need 4 lines) and use custom-built cables. This is more work, but minimizes space usage on the board. This also allows using a grove connector pin order (perhaps even connector), which allows using the connector for other things.

Pin Name Description
1 NC Not connected
2 1μm PM2.5: 0-999μg/m3, PWM Output
3 5V 5V DC Input
4 2.5μm PM10: 0-999 μg/m3, PWM Output
5 GND Ground/min
6 RXD RX UART data (3.3V)
7 TXD TX UART data (3.3V)

For the Honeywell sensor, a 8-pin Molex Picoblad connector is used (51021-0800). Due to the small (1.27mm) pitch, it is probably best to use the same 8-pin connector on the MJS board and order some straight cables.

Pin Name Description
1 +3.3 V power output (+3.3 V/100 mA)
2 5 V power input (5 V)
3 N/A N/A
4 N/A N/A
5 TEST used for testing (NA)
6 TX UART TX output (0 - 3.3 V)
7 RX UART RX input (0 - 3.3 V)
8 GND power input (ground terminal)
matthijskooijman commented 5 years ago

For the temp/humidity sensor, apparently Ideetron supplies another breakout that is cheaper, but has a different pinout. Perhaps we should switch to that? We can probably drop the solder jumpers for the original HTU sensor pinout, but perhaps we should have solder jumpers for the to SI sensor pinouts? It would be useful if the HTU sensor connector followed the Grove I2c connector pinout, so if either module does this, we could stick to that one? I think I remember putting the current SI module into a gateway that has a BBG with a grove connector, so that one probably matches the grove connector... The current breakout has the Grove pinout, so it is probably best to stick to that one.

The grove pinouts are as follows (from http://wiki.seeedstudio.com/Grove_System/):

pin Function Note
pin1 SCL I2C Clock
pin2 SDA I2C Data
pin3 VCC Power for Grove Module, 5V/3.3V
pin4 GND Ground
pin Function Note
pin1 RX Serial Receive
pin2 TX Serial Transmit
pin3 VCC Power for Grove Module, 5V/3.3V
pin4 GND Ground
pin Function Note
pin1 An Primary Analog Input
pin2 An+1 Secondary Analog Input
pin3 VCC Power for Grove Module, 5V/3.3V
pin4 GND Ground
pin Function Note
pin1 Dn Primary Digital Input/Output
pin2 Dn+1 Secondary Digital Input/Output
pin3 VCC Power for Grove Module, 5V/3.3V
pin4 GND Ground
matthijskooijman commented 5 years ago

For attaching a piggyback (power) PCB, the FTDI connector and the power select jumper are good points to connect on. The latter gives access to the battery +, and the regulator input / VIN, so you could even connect a battery charger and/or step up converter there (to put 5V on VIN). This does attach after the polarity protection transistor, meaning the piggy-back is protected from reverse polarity on batteries, lipo or DC plug, but if the piggy-back inserts power itself, the main board is not protected (but this seems less likely).

For efficiency, it might be interesting to have 2 different power inputs on the board: 5V (for a dust sensor) and VIN (which can be the raw battery voltage and passes through the linear regulator to produce 3V3 for the MCU and the GPS). These could both be 5V, but that would be less efficient (having to pass through a step-up converter). On older boards, there is no dust sensor, so no 5V needed. IOW, the voltage from (rechargable) batteries or lipo can be attached to VIN directly (on old and new boards). On new boards, an additional 5V circuit can be attached through a new header pin, and supplied either from the piggy-pack's step-up converter, or from the DC barrel jack. This separation probably requires another jumper to select where the 5V comes from (e.g. attach the jumper to connect 5V and VIN together for the barrel jack usecase, or remove the jumper for the 5V and VIN/battery separated usecase with a piggyback). Or make 5V and VIN the same circuit, but then you lose efficiency in the piggyback usecase (and you can no longer disable the step-up converter when you're not powering the dust sensor).

Is there a usecase for plugging in the DC plug and a piggyback? Or DC plug and batteries/Lipo (with our without piggyback)? The latter is not currently possible, since DC plug and batteries are connected in parallel (and the DC plug and LiPo connector are in the same space).

matthijskooijman commented 5 years ago

The piggy-back should certainly have access to some datapins. I2c and ISP are obvious, since they can be easily shared. This allows putting an MCU on the piggyback for maintainance tasks, such as reading additional sensors, enabling/disabling a step-up converter, controlling or querying a solar/battery charger, etc. I2c is probably the easiest for this, but it might be good to attach SPI as well as some GPIO pins.

matthijskooijman commented 5 years ago

Perhaps we need angled connectors for the 2-pin sensor connectors, to prevent conflicts with the piggyback? Or should the piggyback perhaps not reach that far?

Angled connectors are problematic with the side of the enclosure (if we move the connectors to the side). That also applies to the GPS connecto, which may need to be changed to a non-angled version.

matthijskooijman commented 5 years ago

Some more thoughts wrt to the piggy-back connections:

For the first prototype, I will probably not expose the reset pin to the piggyback, since routing that is too much of a challenge for now. I rerouted some traces and now it was easy :-)

As for the 5V/VIN question, I'll create a 5V net for the dust sensors and expose it on the piggyback header next to the VIN pin, so when powering from barrel jack without piggy-back, we can just jumper these pins together.

matthijskooijman commented 5 years ago

Note that the initial prototype piggy-back header is really for temporary testing (with protoboard), the final design will probably have a different pin order (perhaps also a different position).

matthijskooijman commented 5 years ago

First prototype is done, see https://github.com/meetjestad/mjs_pcb/releases/tag/v3-prototype1

I just ordered 2x10 pieces, expected delivery around the 27th...

matthijskooijman commented 5 years ago

Evaluation of prototype:

pe1mew commented 5 years ago

Hi Matthijs, I just stumbled over the latest release of the meetjestad node. Great development! I am happy with the connector for Honeywell HPM sensor! That will make things easier.

Feature request 1:

However, from experience I know that being able to completely power down particle sensors is mandatory to make the node battery(solar) powered in combination with particle sensors. I therefore request/propose to add FET's to be able to switch power of the particle sensors. In addition I propose the use of a 5V step up/down converter with a Pololu 5V Step-Up/Step-Down Voltage Regulator S7V7F5 (Item #2119). This allows the particle sensor to keep operating even at low battery voltages.

For my tests I have removed the GPS to be able to switch power of my sensor and switched ground of the Pololu converter. During sleep I measured a current 0,6 mA. In my case I am running successfully on 4 AA NiMH batteries using a Ebay 10 euro 5W 5V solar cell. Without the solar cell the node and HPM will run about 24 days on one set of batteries. My code is vailable.

Feature request 2:

For my testing I have added resisitors to be able to measure the battery voltage by the node. I would like to propose additon of such resistors. This functionality is very welcome.

matthijskooijman commented 5 years ago

However, from experience I know that being able to completely power down particle sensors is mandatory to make the node battery(solar) powered in combination with particle sensors. I therefore request/propose to add FET's to be able to switch power of the particle sensors.

I'm currently envisioning two modes:

I believe that should fulfill your request, right?

As for the step-up, those polulu modules indeed look good. The one you mention does not have an enable input, but the S7V8F5 has the same regulator, but with a shutdown There is also the slightly smaller S10V4F5 that only goes up to 400mA (which is likely enough, though).

Some points of note here are the heat production of the regulator (and the influence on the temperature measurements) and the voltage on the shutdown pin (there are pullups to Vin, which could be too much for the AVR, though probably the builtin protection diodes are enough to prevent problems).

Alternatively, we could build a piggyback board that has a regulator integrated (e.g. design an SMD board and have it completely produced rather than self-assembled).

For my testing I have added resisitors to be able to measure the battery voltage by the node. I would like to propose additon of such resistors. This functionality is very welcome.

We added them as well for a few testing boards, in order to do some battery testing. However, we decided against including them by default, to reduce the assembly time and complexity, and reduce the power drain (such a divider typically draws more than the sleeping MCU). Given we get a bigger board, we could consider adding footprints for these resistors (and then just not populate them by default), or at least make sure that the battery voltage is available on the experimenting area. I'll add this to the list of things to consider.

pe1mew commented 5 years ago

I'm currently envisioning two modes:

  • Wall-powered,
  • Solar-powered.

That seems ok to me. For the piggyback board: I like the idea of that. You can produce a board that fits your own needs.

In my case I have I have a 5 watt 5 volt colar cell connected via a schottky diode (to prevent discharching of the battery trough the solar cell) directly to the barrel. The 4 AA NiMH batteries are connected (in parallell to the colar cell) on the pins of the node. Although it is not "nice" I have good experience with this approach. It is similar to tricke charging the battery. I have experimented with charger solutions but these are less efficient that the one described above.

About the polulu regulators: Using one with an enable signal is worth the investigation. When disabled power consumption of the regulator is low, the voltage loss of the FET enabling the converter might be compensated.

Measuring the voltage of the battery is mandatory in my opinion. especially for optimizing and monitoring power consumption. Making the battery voltage available on the experimenting area or adding footprints is a good solution where I prefer the last one.

One last addition could be considering an optional RJ45 connector to the board. This will allow easy extention of I2C sensors and the particle sensor outside of the node housing. See this as an option.

matthijskooijman commented 5 years ago

One last addition could be considering an optional RJ45 connector to the board. This will allow easy extention of I2C sensors and the particle sensor outside of the node housing. See this as an option.

For now, we're aming for grove connectors as a standard expansion connector for (among others) I2c, since that is a somewhat standardized connector. A downside is that it seems hard or impossible to get separate connectors and you have to buy premade cables instead...

pe1mew commented 5 years ago

Good choice to use Grove connectors as this i a general known standard.

The RJ45 connectro can be placed on the piggyback board as long as all important signales are linked trough to the piggyback board.

pe1mew commented 5 years ago

I have evaluated the first prototype board and have these review comments:

ports linked to connectors:

Currently port A0 and A1 are linked to connector P12, P13 and P15. This will reduce the flexibility for connecting sensors. Therefore I propose to link A2 and A3 to connector P13 and expand P15 with A2 and A3.

Antenna:

When I use a small helical antenna (which are my preference because of performance) the antenna cannot be properly soldered. I therefore propose to leave out an opening in the PCB for this antenna. I do propose to add a footprint for a uFL connector. The will allow the use of externa antennas and even better performing antennas than the helical.

clipboard01

Piggyback board obstructed:

The 100 uF capacitors are relatively big. because of this the piggyback board can be lifted by the capacitors. I propose to use smaller capacitor or axial versions instead of radial, Another option is to move the capacitors out of range of the piggy board size.

clipboard02 I now have to wait for 10k trough hole resistors to complete the PCB and program the AVR. :-)

matthijskooijman commented 5 years ago

Currently port A0 and A1 are linked to connector P12, P13 and P15. This will reduce the flexibility for connecting sensors. Therefore I propose to link A2 and A3 to connector P13 and expand P15 with A2 and A3.

I picked A0 and A1, because they are not used yet in practice at the moment (A0 is completely free, A1 is only used for the soil moisture which we're not actively using yet). Using other pins gives more flexibility in the expansion, at the expense of not being able to use the existing sensor connections at the same time. I'm not so sure what the best approach is here, but I guess a little more variance would be good.

As for the antenna: with a helical antenna, its view might be obstructed by the GPS module, so it might need to be moved up a bit (taking care to make the trace 50Ω). Alternatively, we could have a look at using a PCB trace antenna, which would make the board even simpler in assembly. Adding a u.FL fooptrint is a good idea in any case, for when you need a bit extra range).

As for the capacitors, on our boards I think we use one smaller and on bigger cap (at least in value, not sure about physical size). I'll check a more recent board to see how it is there. IIRC we cannot use the smaller (value) caps in both places, since then the GPS power-on current resets the board...

Also, we could consider switching to a cheaper/better RF module, Thomas Telkamp suggested there are better alternatives. There is also a new transceiver chip that would be more efficient (SX1762), but also is not supported by LMIC at the moment (but there might be a new LMIC-based stack in the near future that does support it).

As for solar, I also heard that Thomas was experimeting with a MPPT chip and a LiPo and found that he could power the board with a very small solar panel too. I'm not sure what the power usage was though, probably without a dust sensor.

matthijskooijman commented 5 years ago

It turns out the Sensirion SPS30 sensor (that we'll also considering) can do both UART and I²C communication (switched using a pin on power-up). I²C is probably a lot more efficient in terms of code size (mostly due to simpler parsing. Code saved due to reuse of the Wire library is probably comparable with reuse of the SoftwareSerial library). Also, I²C can share I/O pins with our existing I²C sensor. A downside is that we can connect only one sensor through I²C, since the I²C address is fixed (there does not seem to be an UART command to set it either). For this to work, we should probably have an I²C port connected to 5V/Vin as well.

We could also consider switching from AAA batteries to AA batteries. Now the pcb is a bit bigger, we have room for that. This would lead to a significant increase in capacity and battery life.

Alternatively, we could consider switching to 4 or 5 batteries so we can perhaps power the air quality sensors directly from the batteries, without needing a step-up converter (this probably still needs a regulator and needs 5 batteries to allow rechargable batteries, since 4x1.2V is only 4.8V). The downside is that you're wasting more power in the regulator during sleep time, but combined with a solar charger that might not really be relevant.