Skip to content

Electronics Design Notes

Jim Heaney edited this page Oct 28, 2024 · 15 revisions

System-Wide Standards

System Assumptions

The system was originally designed and intended to be made of one Core and one Switch, but there are situations where more than one Switch or some other accessory may be needed. In these scenarios, only one Core can be used at once. These are multiple signals in an ACS deployment that are intended to come from or go to a single source, adding multiple cores would be too complex. Furthermore, ACS deployments make no checks that the proper number of power providers are there for all power consumers to operate properly. Devices are designed to fail gracefully in such situations, but it is on the person deploying the system to ensure there is enough power available for all consumers.

Design Practices

The system was designed with the end user being hobbyists, hackers, makerspace staff, etc., and that the design would likely be assembled in small quantities, potentially by hand or using consumer-grade assembly machines. Alternatively, it is possible some would want to have these assembled by a professional service like JLCPCB.

To satisfy both requirements, general restrictions where put on components.

  • All components need to be assemble-able by JLCPCB, preferably as a part they normally stock. So-called "Basic Parts" should be used as much as possible, to reduce assembly costs.
  • All passive components should be at least 0603-sized or larger, to make hand-assembly possible.
  • All ICs, where possible, should have leads with as large of a spacing as possible. For modules, they must have large castellated holes at a wide pitch. Both of these are to make hand-assembly simpler.
  • Through-hole parts should be avoided where possible, but if a design already has some through-hole parts, we should try to make it all through-hole to make assembly faster.

Some other general notes on component selections;

  • Electromechanical and connectors must be THT mounted for strength. Any outward-facing connectors or electromechanical parts need additional mechanical solder points for increased strength.
  • Where possible, use parts that have multiple alternative generic components that can be implemented. This mostly applies to basic ICs and passives.

Unique Identification

There are 2 ways to identify the components that make up an ACS deployment;

First, the Switch has a identification pin. This pin is grounded through a 1% or better resistor, with a value determined by the switch type. This allows the Core to identify what Switch it is connected to. The values of these resistors are noted below in their respective sections.

Second, all discrete components of the ACS have a Dallas DS18B20 or comparable OneWire temperature sensor. In addition to their primary use of monitoring temperature, this provides each component with a globally unique 64 bit identifier.

Both of these can optionally be monitored to ensure the intended deployment of a system, and that no components have been swapped or tampered with.

Connection Standard

All switches, and any other devices that connect to ACS, must comply to a connector standard. Components that connect in ACS must do so only through a single standard DE9 connector. No device, except for special signal splitters or "inline" devices, are allowed to have more than one DE9 connector. All devices are intended to use a female DE9 connector, so male-to-male cables are used to connect them. The pins in these connections are straight through (e.g. Core pin 1 to Switch pin 1). All pins must have up to 2kV ESD HBM protections guaranteed by all devices.

The pinout is as follows;

  1. NOHP: Signal indicating the Switch should be opened. Specified as a 5v logic level, but high is actually referenced to the Core's input power at the power pin (pin 4). Source needs to drive and sink at least 20mA on this line. Switches and other devices are permitted to use up to 10mA of this drive strength. Signal is normally open, meaning it is drive high when the equipment should be on. All components must be designed to return to an open state when this pin is floating.
  2. TEMP: OneWire bus, intended primarily for temperature sensors. Pulled up to 3.3v at the Core.
  3. Ground: All components of ACS must have a shared ground reference, unless otherwise not permitted for compliance with another standard.
  4. Power: 5v power for system. See the "Power Standards" section below for more information.
  5. Ground: All components of ACS must have a shared ground reference, unless otherwise not permitted for compliance with another standard.
  6. Identification: All devices except the Core are required to have a 1% tolerance resistance connection between this pin and ground to identify its type to the Core.
  7. Interrupt: Allows devices in an ACS deployment to notify the Core, by pulling this pin low. There is no standard for what pulling this pin low entails, although it can only be pulled low by devices that can somehow receive an acknowledgement from the Core and clear the interrupt. The Core pulls this pin up to a logic level that can be anywhere between 1.8 and 5 volts, and any other device cannot pull this pin up.
  8. Reserved: This pin is reserved for future use. It should be left disconnected if not used. Assume it is a push-pull, 3.3v logic level digital pin.
  9. Reserved: This pin is reserved for future use. It should be left disconnected if not used. Assume it is a push-pull, 3.3v logic level digital pin.

Power Standards

ACS deployments are intended to harvest their needed power from one of the Switch devices, which will then share it with the Core and any other power-consuming devices. System power is a nominal 5v rail. Any device with access to a non-limited (i.e. not a battery, generator, etc.) external power source must make power available as a power-providing device. The following specifications dictate the design of power consumers and providers.

Power Providers

  • Must be able to supply at least 400mA continuously at the DE9, without voltage going more than 500mV below or 200mV above nominal. This stability must be ensured at all loads from 0mA to maximum output.
  • Must implement reverse-polarity-protection on the power output, such as a diode, allowing other power-sourcing devices to be connected without interference.
  • Must provide active current limiting on this pin, to respond to short circuits elsewhere in the system without the provider itself losing power. This current limit can be set anywhere between 450 and 1500mA nominal. This active current limiting must be able to withstand perpetual short-to-ground scenarios, and return to normal operation within 5 seconds of the short being removed.

Power Consumers

  • Must be designed to consume no more than 300mA from the ACS system.
  • Must operate up to 1V below nominal, and up to 500mV above nominal input voltage.
  • Must integrate active current limiting, with the same short-to-ground and recovery criteria of a power provider. The current limit for consumers must be set at no more than 400mA.

Specific Component Details

Core

Network MCU

The Core is built around an ESP32 S2. The S2 was originally chosen for its ability to act as a USB host, when the plan was to integrate a magstripe reader. The component was kept since it is a good overall network-capable MCU, widely available in a small-form-factor module for a reasonable cost. It also reduces BOM cost by having so many components integrated (RAM, flash, oscillator, etc.). Lastly, ACS was designed to be open-source and modification-friendly. The ESP32 is the most widely-used wireless MCU by hobbyists and in makerspaces where you'd expect this system to be deployed. Perhaps a multi-core ESP32 would have been a better idea, to eliminate the current 2-MCU design in use. Furthermore, Bluetooth may have been useful as a secondary peer-to-peer network option, which the S2 does not support.

Frontend MCU

To ensure a good user experience, any interactions with the local user are managed by a secondary MCU, in the most recent version (V2.3.2 as of writing) this was an AtTiny 1616. This is responsible for detecting cards, controlling the switch, driving the status LED, reading the key switch/button, etc., and communicating back to the ESP32 via UART. This allows the ESP32 to be as inefficient and blocking as it wants/needs (leading to much simpler code to write, debug, share, etc.), without having a negative impact on the user experience.

Frontend Electromechanical

There are 2 electromechanical components of the Core that are not directly mounted to the PCB; the button and the key switch.

The keys witch is a KO132C1501 by E-Switch. It can be purchased from most major electronics suppliers. Ideally we'd instead use a 1 common, 3 output switch to indicate the 3 positions. But most 3 position key switches are actually 2 complete circuits, then one open position. This made the wiring a bit more complex, but it still works fine. The switch needs to have 4 leads at least 75mm long soldered on.

The pushbutton is a ChromaTek 19mm Silver Momentary button with an integrated WS2812 LED. There are not many affordable solutions for RGB pushbuttons, and basically none that have a controller integrated like this. These switches can be purchased from Amazon, or comparable ones from Adafruit. They come with a pre-made wiring harness that can be used directly.

The wires for these parts are put into angled screw terminals on the board, that allow for tighter integration. Due to space constraints, the wiring could not be silkscreened onto the board, so a reference has to be used during assembly. To install these components correctly, it is recommended to crimp a ferrule before installing the wires into the terminal.

The 2 circuits on the key switch and the normally open circuit of the button are debounced using an RC circuit and a Schmitt Trigger, giving a 20mS delay on presses being registered. While this effectively eliminates bounces, it can create "anti-bounce", where rapid successive switches are not registered. See Texas Instruments Reference Document SCEA094 for more information.

Card Reader

One of the key reasons for starting from scratch on V2.X.X on ACS was RIT's transition from mag swipe to NFC ID Cards for all students, faculty, and staff. Previous iterations of ACS relied heavily on the mag swipe.

To reduce development times and costs, an off-the-shelf NFC reader module was used, the PN532 module developed by Elechouse. This is the most widely used NFC reader for hobbyist projects and is well supported, but the chip is EOL so parts are getting more expensive. Nonetheless, the module supports all features needed by the system. A future iteration (this was written with the release of V2.3.2) may include a directly-integrated NFC reader IC. This'd make the design more reliable, easier to produce, and more resilient to supply chain issues.

Paired with the card reader are the card detection switches. To ensure the user is the one actually using the device, it was decided that the card must remain inserted into the machine. This is determined by 2 limit switches mounted directly to the PCB, and debounced the same way as the key switch and button.

USB

The Core has a single Type B USB connection, that can be used for programming, debugging, configuration, and powering the Core (but not attached devices). The USB port primarily connects to a CH340C USB-UART programmer, wired to act as a programmer for the ESP32.

USB is where most of the differences between the Lite and Full editions of the Core come from. In the Full edition, the USB port connects to an SL2.1 USB hub internally, allowing 2 more USB devices to be wired up internally. The first of these is a UPDI programmer allowing the frontend MCU to be programmed without opening the Core, and the second is a debugging UART CH340 connected to the default UART pins of the AtTiny. In the Lite Edition all of these components are unpopulated, and instead 2 0R 0603 resistors bridge the USB port to the ESP32's CH340C.

Ethernet

The second major difference between Lite and Full edition is the ability to connect via Ethernet. The ESP32 S2 doesn't have an Ethernet PHY like the original ESP32 did, so a full MAC+PHY was needed. The WizNet W5500 is the classic MAC+PHY used by hobbyists, and is widely documented and supported by open-source code. The W5500 was implemented following the Arduino Ethernet Shield Schematic. It was difficult to implement the PHY side of the IC using only 0603 components, but it was doable. The inclusion of Ethernet also required moving to a 4 layer board for proper impedance matching, slightly increasing cost.

AC Power Switch

The AC Power Switch was one of the hardest to design, and is the Switch that went through the most iterations. The switch functioned from revision 1, but subsequent revisions worked on reducing the size and assembly complexity. For instance, the first 2 revisions used an input and output receptacle that both were independent of the PCB, requiring time-consuming soldering, crimping, and wire management. In addition, the Switch was physically much larger.

Board-Mounted Connectors

Board-mounted connectors was the biggest innovation in the AC Power Switch. This enabled a much smaller, cheaper, and easier-to-assemble design.

For the power inlet, there are many options. An IEC C14 connector was chosen based on its ability to handle 15A continuous, as well as its prevalence. Specifically, the IEC-EW-4 by Adam Tech was selected. It is a low-cost, 15A-rated, right-angle C14 that is primarily board-mounted, but also has a locating flange and both vertical and horizontal screw mounting considerations, making for a very rigid connector.

The power outlet was the harder of the two. To maintain interoperability with any normal wall-powered device, we wanted to design around a NEMA 5-15R. This receptacle is very hard to find in board-mount varieties. Most are rated for very low current, or are meant for connecting to wires. Most large-scale applications would mount the contacts and mold the 5-15R design into the product directly, but this is not feasible for a DIY, low-volume application like this. The first candidate explored for this application was the TE Connectivity 3-213598-2. This is the perfect part for the application, but is hard to source. Furthermore, there are lead-based variants of this PN, meaning many companies will not carry it or import it (even if the lead-free variant is specified). A second option, the 739W-X2/32 by Qualtek is used now instead. This is connector is cheaper, easier to source, and produced in higher quantities than the TE one. Its main drawback is that it appears to be intended for panel mounting, with the PCB hanging off of it, rather than the connector being located by the PCB. This may introduce complexities in designing the enclosure, but it should still be a realistic option. At the time of writing, only boards with the TE part have been deployed, and Qualtek ones are on order now.

Fusing

The AC Power Switch design always had fuses in it, but finding a good fuse was hard. Most fuse holders rated to 110VAC are only rated to 7A or so. The other option is soldered fuses, but these'd be much harder to replace, especially considering how large the power traces would be.

LittelFuse has a solution to this, a high-current, board-edge-mounted fuse holder. This holder also provides the benefit of working with both metric 5 x 20 and imperial 1/4 x 1-1/4 fuses, by choosing a certain cap. Both solutions use the same soldered part (03450101HX010). LittelFuse offers the cap and body as a combo to save a bit of money (e.g. 03450121H).

Two fuses are used; one on the regulator, and one on the power output. This allows for the ACS to still be powered if the downstream device burns its fuse out.

Switching

One of the hardest parts of the AC Power Switch was the actual switching. There are plenty of relays that can switch 15A at 120VAC, but these are for resistive loads. A lot of the shop equipment we'd use the AC Power Switch on is actually a large inductive motor, so a more specialized switch is needed. Most of the switches rated for switching inductive loads like this have odd pinouts, usually having the LV and HV sides cross over. The AC traces on this board had to be on both the top and bottom, so this was not feasible.

We eventually settled on the HF165FD-G/24-HY1STF by HF (Xiamen Hongfa Electroacoustic). This relay is rated to 40A at 277VAC, but more importantly it is UL rated to 1HP at 120VAC, and TV-8 at 125VAC. This makes it sufficient for most 120V machine tools. In our own testing, the relay withstood repeated connections and disconnections of a 2HP motor, with peaks over 30A.

Regulation

Clone this wiki locally