-
Library
12/31/2019 at 01:12 • 0 commentsToday I decided to try and write a CircuitPython library for this sensor. So with a datasheet in hand I started with this simple code that is supposed to give me the raw data frames:
import board import digitalio import time class MGC3030: def __init__(self, i2c, addr=0x43, ts_pin=None): self.i2c = i2c self.addr = addr self.ts_pin = ts_pin self.buffer = bytearray([0] * 26) def read(self): self.i2c.try_lock() try: self.i2c.readfrom_into(self.addr, self.buffer) finally: self.i2c.unlock() return self.buffer i2c = board.I2C() ts_pin = digitalio.DigitalInOut(board.D5) irq1_pin = digitalio.DigitalInOut(board.D6) irq0_pin = digitalio.DigitalInOut(board.A3) sensor = MGC3030(i2c) while True: print(repr(sensor.read())) time.sleep(0.5)
The code works, except it shows me all 0s. What's wrong?
Some more careful reading of the datasheet reveals that the chip is sold without firmware on it. You have to program it yourself, using attached software. The software is of course WIndows-only, so no way I can use it.
Way to go Microchip!
-
Discretes and Schematic
11/02/2019 at 20:57 • 0 commentsI populated the rest of the shield, and its seems to work — at least it shows up on the I2C bus. Further testing will require writing a library for it.
I also fixed the schematic view, so that it can actually be understood. This is something I like about Fritzing — you can do the schematic later.
While making the schematic, I also discovered that the version of PCB I have misses one connection (for the I2C address selection resistors), so I will need to bodge that in the prototype. The final version has that fixed.
-
Redoing It
11/02/2019 at 11:04 • 0 commentsI figured that as soon as I start working on it again, I will find the old prototype. It didn't work, but I did find the chips I had ordered for it, so I can just make a new one.
There are two tricky parts to the mechanical assembly, first is the FeatherWing header:
I'm using a feather to get the right spacing and alignment, ad then just soldering the angled headers to the pads. Finished, it looks like this:
I had to cut some of them shorter, where the pull-up resistors for the I2C go. The current version of the PCB has that fixed, as the resistors are moved to the other side of the header.
Next are the pins that connect the antenna to the main board:
It takes some re-heating and aligning them to fit them in their holes, but the end result looks good:
Next comes the chip itself:
Now I need to check the values of all the discrete components in the datasheet and solder them, and it will be ready for testing. That will probably happen in a week from now, because I will be travelling, and I can't take it with me.
-
Lost in Time and Space
11/01/2019 at 20:23 • 0 commentsI started this project quite a while ago, and it was an unlucky one — always when the parts arrived, I was in a bit of slump, busy with some urgent thing, travelling, or just simply burned out. So the progress was slow, and I only took it as far as assembling and soldering the whole thing — I didn't have the energy to actually write the software to test it.
And now I'm bringing it back from the dead, so to speak, to enter it in this contest, but... I can't find it. I clearly remember assembling the prototype, but it's not anywhere in my drawers or boxes. I found the un-assembled PCBs, so I could get another chip and start again, but I would much prefer not having to do that.
I guess I will need to do a proper cleanup of my workspace.
-
PCB Design
11/01/2019 at 19:52 • 0 commentsTo avoid paying extra for two PCB designs, both layers of the sandwich are connected at the corner — they have to be cut manually for assembly.
The design above has the copper fills removed for clarity. The antenna pretty much follows the recommendations from the datasheet. The traces going to it are kept as short as possible.
To avoid puncturing the ground layer, the connector for the Feather is made out of an angled male header, soldered SMD-style to the board. In a final design, a proper SMD header could be used instead.