Quantcast
Channel: The Sync Channel Blog
Viewing all 38 articles
Browse latest View live

Schematic of the CTS 1960017 10MHz OCXO

$
0
0
Recently, I posted a teardown of a CTS 10MHz Oven Controlled Crystal Oscillator (OCXO). Using the unit that I opened up, I was able to work out the schematic for the boards inside.

This is what's left of the CTS OCXO I did the teardown on. Poor thing...


Construction


Internally, the OCXO consists of two boards. One is the larger, main board with most of the components. It contains the oscillator circuit, voltage control and voltage reference circuitry, heater control, and output buffering/filtering. The ceramic board adhered to the bottom of it is the heater. It contains two power devices and two temperature monitoring devices. The 10MHz crystal is bonded to that ceramic board, but connects directly to the main board. The two boards connect via five pins that are directly soldered.

The board assembly is mounted on pins inside the can, which also extend to the outside of the unit. The only insulation material in the unit is the small, brown strip seen in the above photo. It wraps around one side of the crystal when everything is assembled.

Externally, the OCXO has five pins: 5V, GND, 10MHz OUTPUT, VREF, and EFC. Those pin names are used as labels for various nodes in the schematic below where they connect.

Schematic


I was able follow the components and traces on the boards to work out the schematic. After getting a rough outline, I removed all of the capacitors and inductors and measured their values out of circuit as accurately as I could.

There are only two ICs on the main board. One is an LM2902 quad opamp. Three of the opamps are used and one is terminated. The other IC is a TC7S00FU single NAND gate that is used as an output buffer.

The two power devices on the heater board are BST50 NPN darlington transistors. The temperature sensors are TI LM45s.

Schematic of the CTS 1960017 10MHz OCXO.
Click to make it larger, then right click to download it.

Wrap Up


So what do you think? Is the circuit simpler than you expected, or more complex? It's very interesting to see this take on a modern 5V, 10MHz OCXO. I suspect internal construction and complexity varies greatly between device families. Please post any questions, comments, or corrections below.

Thanks for reading!

- Dan W.


LoRa FeatherWing IOX for Adafruit Feather

$
0
0
In this post I will document another custom FeatherWing that I have designed for the Adafruit Feather line of microcontroller boards, the LoRa FeatherWing IOX.

LoRa FeatherWing IOX on a Feather HUZZAH ESP8266.

Introduction


Last month I posted about a LoRa FeatherWing Development Breakout that I made for Feather. Please check out that post to learn more about LoRa, the HopeRF RFM95/96(W) modules and potential uses of the breakout.

The LoRa FeatherWing IOX (I/O eXpander) is a follow-up to that design. The RFM95/96(W) side of the board is exactly the same as on the earlier FeatherWing. The big difference on the IOX is that I have replaced the breakout header for the Digital IO, chip select, and reset lines from the RFM module with an MCP23008 8-bit I/O expander. This chip allows the Adafruit Feather to control all of those pins on the RFM module over I2C. It is a huge step forward in this project, because it eliminates the manual wiring required for the breakout. This FeatherWing does not tie up any of your digital I/O pins on the Feather, and it makes the board compatible with any Feather variant. This is particularly important for the Feather HUZZAH ESP8266 which has a limited number of GPIO available.

Current LoRa and LoRaWAN libraries can be modified to incorporate the simple MCP23008 I2C library to drive the RFM module. I have also developed example programs to turn a Feather HUZZAH ESP8266 into a LoRa gateway to Adafruit IO using Wi-Fi.


A node with LoRa FeatherWing IOX, Feather M0, MCP9701 temperature sensor and a Li-Po.
The node transmits data bursts to a Feather HUZZAH acting as a gateway,
which then pushes the data to Adafruit IO over Wi-Fi.


Incorporating the I/O Expander


To incorporate the MCP23008 into my earlier example programs, I used the Adafruit library for the chip. I felt this was a good approach, because if you are using Feathers you are likely already familiar with downloading Adafruit libraries. The library is quite simple. You use the same digitalRead and digitalWrite commands you are familiar with in the Arduino IDE, but you call them as member functions to the MCP23008 object. For example, to drive DIO0 low on the RFM module you would type "iox.digitalWrite(DIO0, LOW)" instead of the normal "digitalWrite(DIO0, LOW)".

If you want to write your own code for driving the chip, that is certainly possible as well. I broke out the interrupt pin from the MCP23008 to solder jumpers to select one of five digital I/O pins on the Feather to send it to. This could be used to increase efficiency of your code and minimize delays in seeing pin state changes.

The Interrupt pin from the MCP23008 can be sent to a digital pin on the Feather if desired.
The I2C address of the chip is fixed as 0x20.


Example Programs


I have three example programs for this board. Two are very similar to my earlier example programs for the Development Breakout. One configures the Feather as a beacon node that sends periodic data bursts, while the other is a general-purpose Transceiver program that is set up to receive the data from the beacons and print it out to USB serial.

In these examples, I am sending temperature data from an MCP9701 temperature sensor. You can of course modify the programs to send any sensor data you like. I also send the battery voltage reading using the battery monitoring circuit built in to Feather M0 and 32U4.


Receiving data from two different Beacons and viewing it in a serial terminal.


The third program I have provided is a bit more interesting. It is intended for use with the Feather HUZZAH, and not only echoes the received data to USB serial, but also pushes it to Adafruit IO using the MQTT library. Being able to get data into the "cloud" from nodes several kilometers away using LoRa modules instead of cellular could be a great addition to your sensor monitoring project.

Feather HUZZAH with a LoRa FeatherWing IOX.
Push the data to Adafruit IO over Wi-Fi for monitoring, graphing, and logging.


Monitoring the data from the Beacon nodes on Adafruit IO.


Please note that these are very simple programs intended as templates to build in the full functionality your project requires. One issue you might need to solve is how to handle multiple beacons trying to transmit at the same time. The overlapping transmissions will cause un-reliable reception at the gateway. A fix for this is to poll the beacons for updates from the gateway node, and only allow them to transmit when they are polled. Another possible fix is to send a response from the gateway when it successfully receives a data transmission. If a beacon doesn't get an acknowledgment, it should wait a random amount of time and try again. This provides some amount of de-confliction on the wireless link.

Shared as Open Source Hardware (OSHW)


LoRa FeatherWing IOX: Order PCBs on OSHPark!



LoRa FeatherWing IOX Schematic

LoRa FeatherWing IOX Board Layout

Assemble Your Own


Here is the information you need if you'd like to order PCBs and make your own LoRa FeatherWing IOX boards.

Parts List:
  • LoRa Module: HopeRF RFM95W or RFM96W (pick the correct frequency for the ISM bands used in your country)
  • I/O Expander: MicroChip MCP23008 18-SOIC
  • RF Connector: SMA or RP-SMA Edge-Launch for 1.6mm/0.062" board thickness 
  • C1: 47uF 1410 Tantalum SMD capacitor, 10V rated minimum
  • C2: 1uF 0603 Ceramic SMD capacitor
  • C3, C4: 100nF 0603 Ceramic SMD capacitors
  • LED: 0805, color of your choice
  • R1: 680 ohm 0603, or adjust value to change brightness of LED
  • R2, R3: 4.7k ohm 0603 resistors (I2C pullups)
  • Headers to connect the FeatherWing to the Feather board
  • Antenna suitable for the frequency range supported by your RFM module
Notes: You can do away with the LED and R1 if you don't want an additional power indicator. Also, if you are using another FeatherWing that has I2C pull-ups on it, omit R2 and R3. Only one set of I2C pull-up resistors should be used on Feather.


Going Forward


I am quite happy with this development in my project to bring LoRa functionality to Adafruit Feather. Please let me know if you assemble one of these boards, I am always looking for feedback. Also, I'm curious to see if someone will modify an existing LoRaWAN library to use this board on a Feather HUZZAH. I believe overcoming the I/O restrictions of the ESP8266 module will help further development in that regard. I know there is much more to be done, but I hope my small contribution to the hardware side of these endeavors is of use.

As to future LoRa boards, I would like to make one additional board with multiple sensors on it to be used as a ready-to-go Beacon node. I am also exploring ways to fit a U-Blox GPS module onto this FeatherWing.

Once I am done developing boards for the RFM95/96(W) modules, I may turn to a more sophisticated LoRaWAN module, such as the MicroChip RN2903. Wouldn't an actual Feather board with that module built in be cool? How about a FeatherWing Doubler with the microcontroller circuitry and a wireless module built directly onto it instead of prototyping area? That would give you two spots for FeatherWings and a huge amount of functionality.

As always, please post comments, corrections, and suggestions below.

Thanks for reading!

- Dan W.

Checking Out the New Atmel ATtiny102/104

$
0
0
In this post I will discuss my experiences with the Atmel ATtiny104 Xplained Nano kit, and compare this new microcontroller from Atmel with other ATtiny devices.

The Atmel ATtiny104 Xplained Nano evaluation board.

Introduction


I love microcontrollers, and I do my best to keep up with new devices being released from the major manufacturers. Recently, I saw that Atmel had released new ATtiny devices, the ATtiny102 and ATtiny104. I decided to order one of their Xplained Nano kits for the ATtiny104 and check it out. The board costs $4.50 USD and is available from Digikey right now. Other distributors have it on order.

Let's be honest, the cool box is worth the price of admission. 


ATtiny102/104


First step in researching any microcontroller: look at the datasheet. Let's get a few of the basics out of the way first. The ATtiny102 is an 8-pin device that comes in SOIC and UDFN packages, and the ATtiny104 is a 14-pin version of the device that comes in SOIC only. The larger device has extra GPIO, and extra channels on some of the peripherals such as the Analog-to-Digital Converter (ADC), but otherwise they are identical.

 Pinouts of the ATtiny102 and ATtiny104 in SOIC packages.


As I read through the key features of the new microcontroller, I immediately saw some parallels to the ATtiny4/5/9/10. I played around with the ATtiny10 quite a bit when it first came out, and recently developed a super tiny breakout board for it. However, I saw some very interesting additions to this new device, such as a hardware USART. I decided to make a table comparing the key features of the ATtiny102 and ATtiny10 (8- and 6-pin devices respectively). I also included the classic ATtiny85 in the comparison that has served me well in numerous projects. The ATtiny85 is well-known and loved by many embedded developers and electronics enthusiasts alike, and it even has coveted Arduino support to help make the device accessible to all.

Comparing the key features of the ATtiny102, ATtiny10, and ATtiny85.
(Unit costs shown are from Digikey, 3/18/2016)

We see many similarities between the ATtiny102 and the ATtiny10, especially in the amount of FLASH, SRAM, instructions, and general purpose working registers. However, the new device has some key upgrades. The most important of these is probably the hardware USART, which can also work in an SPI Master mode. While the ATtiny10 is very capable at collecting data from sensors and the like, it has almost no way to pass that data on to another device for processing. It is meant to handle simple, embedded tasks on its own. Given the tiny board space occupied by the SOT-23-6 chip and the low cost, it does very well in that regard.

The hardware USART on the ATtiny102 opens the device up to many more projects and potential uses. You can pass data on to another microcontroller, or even transmit it using a wireless module that accepts data over serial and handles the wireless transceiver functions on its own. Additionally, the ATtiny102 has some upgrades on the ADC front. Importantly, it has 10-bit resolution, where as the ATtiny10 has an 8-bit ADC. Besides an extra ADC channel, you also have three internal voltage references in the new device which can improve the accuracy of your measurements, especially when powered from varying supply voltages.


Comparison with the ATtiny85


In many regards, the ATtiny85 is a more robust device. The extra FLASH, SRAM, working registers, and instructions are crucial when developing more complicated solutions. Tasks we take for granted on many AVR devices such as floating point arithmetic and string manipulation are very difficult to implement on the ATtiny10 and ATtiny102/104. The ATtiny85 also comes in a DIP package, which is important to many electronics hobbyists.

However, the lack of a hardware USART on the ATtiny85 has always been a limitation. You can do software serial, but a hardware peripheral is very welcomed when available. Also, the ATtiny85 only has 8-bit counters, where as the smaller ATtiny devices have single 16-bit counters.

Finally, the ATtiny85 costs more, even when purchased in volume. The price difference doesn't seem large on the table above, but component cost adds up when using many of the devices in a solution, or designing something that will be produced in quantity.


ATtiny104 Xplained Nano


Atmel did a great job on their evaluation board for the ATtiny104. The board has a programmer and debugger built in! Simply plug it into your computer with a USB cable and it connects directly to Atmel Studio 7 for programming. I encountered no issues working with the board in Atmel Studio, though I did have to update the program before using the board.

My favorite feature of the Xplained Nano board is that you can connect to the USART on the ATtiny104 over USB and talk to it with a serial terminal. This is HUGE for prototyping and development when you need to read out your data for debugging and verification. The serial link is available as a simple COM port, and I found that I could keep it connected to my terminal program even when re-programming the chip.

The ATtiny104 Xplained Nano has a user button and LED on board, and breaks out all pins of the microcontroller. Additionally, you have some options for taking current measurements and running the ATtiny104 at supply voltages other than 5V USB.

Check out the official documentation on the evaluation board for more info:

ATtiny104 Xplained Nano User Guide
ATtiny102/104 Getting Started Guide

Wrap Up


I enjoyed working with the ATtiny104 evaluation kit, and I plan to order some bare chips when they are available from distributors. This new microcontroller from Atmel does have limitations as I discussed above, and other AVRs may be better options for your project. But if you have worked with the ATtiny10 before and just wished it had a USART, or if you need a low-cost chip for simple embedded tasks in a project, I think this is a good device to consider.

Thanks for reading!

- Dan W.

DIY LED Light Bulb Kits

$
0
0
Recently I saw a video by bigclivedotcom on YouTube about LED light bulb (lamp) kits from eBay. I decided to pick up a few of these kits and check them out. I was not disappointed!

LED light bulbs I assembled myself. Lots of fun!
The LED colors shown are cool white diffused, multicolor and warm white clear.


Cheap LED Lamp Kits from eBay


These kits can be found for less than $2 USD on eBay. One example listing to start your search if you want to purchase your own is #171505070176. That price does not include LEDs, but the real beauty of these is that you can assemble them with any LEDs you want. You can purchase white LEDs in many different color temperatures, such as cool or warm white. Colored or multi-color LEDs are also an option, as Big Clive did in his video. He also did a video assembling one of these kits with neon lamps!

The kit comes with the plastic housing, a clear plastic dome, two small circuit boards, and the parts you need to assemble the power supply circuit. The ones that I ordered house 38 LEDs, but there seem to be a variety of kits on eBay in different configurations. Grab some of these and a huge bag of cheap LEDs and you are ready to make some light bulbs!

Contents of the DIY LED lamp kits.

Assembly


The kits do not include any instructions, but assembling them is pretty easy. All of the component values on the small green power supply PCB are labeled in the silk screen. Just place the parts as shown and solder it up. Do be careful with the polarities of the electrolytic capacitor and diodes, though. The circular LED board clearly shows the correct polarities for the LEDs, so that is also easy to stuff.

The LED and power supply boards assembled and ready for installation.

Strangely, the attachment points for the power supply on the LED board are just pads without drills. Hmm.... The board in one of the kits I got had misaligned solder mask that exposed a trace between two LEDs next to the DC input pads. Yikes! These issues may or may not be present on the boards you get.

Attachment points on the power supply and LED boards.
Can you spot a safety hazard here when they are crammed into the housing?

As I started to install the boards into the housing, I saw that it would be very easy for shorts to happen between the exposed electrical connections on the undersides of the boards. I decided to put electrical tape across the bottom of the power supply board to insulate it from the LEDs.

Almost done!

Before snapping on the clear plastic dome, test the bulb to make sure it works. Murphy will ensure that at least one LED doesn't work if you don't test it first. It goes without saying, but please be careful when doing this. The power supply board has completely exposed mains AC voltage on it.

Super cool custom LED light bulbs.
The bulb with blue, yellow, and orange LEDs makes a nice violet color.

Wrap Up


These are fun little kits. I wouldn't recommend them for making light bulbs to install throughout your home. The obvious safety hazards of these kits and inconsistent hand assembly make them a bit dangerous. However, I think they are useful for fun projects and making novelty LED light bulbs that will be used in a controlled setting.

Thanks for reading!

- Dan W.

Atmel SAM D09 Development Board

$
0
0
In this post I will document a development board that I designed for the Atmel SAM D09 microcontroller.

A fun little development board for the Atmel SAM D09.

Introduction


The Atmel SAM D series of 32-bit microcontrollers includes several devices, each with a long list of features at great prices. Perhaps the best known of the series in the maker community is the SAM D21 due to its use on the Arduino Zero. However, there are several other devices in the product line that are worth taking a look at. The smallest of the bunch is the SAM D09 that comes in a 14-pin SOIC package. The 14SOIC package is one of my favorites. It is easy to solder, easy to break out on a PCB, and takes up little board space. I decided to order some SAM D09C chips and design a small development board in order to learn more about the capabilities of the device.

Atmel SAM D09C


The SAM D09C in the 14-pin SOIC package is capable of running at 48 MHz, includes 8K of FLASH and 4K of SRAM, and has 12 GPIO pins with numerous peripherals. Despite the significant upgrades compared to similarly-sized 8-bit AVR microcontrollers, it is actually cheaper! For example, when purchased in single quantities the SAM D09C costs $1.15 USD, versus an ATtiny841 which is $1.67 USD. (Prices from Digikey, 3/20/2016). The ATtiny841 is one of my favorite AVR devices, and quickly replaced the use of the venerable ATtiny84A in my projects when it came out. However, this SAM D09C has me considering yet another update for my projects that need a 14-pin microcontroller. Once you are familiar with programming ARM Cortex-M devices, upgrading to feature-packed 32-bit microcontrollers makes sense for numerous reasons.

Let's take a look at the pinout and a table of features for the SAM D09.

Pinout for the Atmel SAM D09C (14SOIC).


Features of the SAM D09 devices in SOIC and QFN packages.


Development Board


The development board that I designed for the SAM D09C makes it very easy to work with the device. The pins of the microcontroller are broken out to standard 0.1" headers. I included a high-quality 32.768 kHz external crystal, which can be used with the on-board DFLL or DPLL to generate system clock frequencies up to 48 MHz. You can also use it with the Real-Time Counter (RTC) in the SAM D09 for accurate timekeeping. Additionally, I included a reset button, power LED, and a user LED connected to pin A25. The chip is programmed via a 10-pin Cortex Debug header.

Connect an Atmel ICE to the Cortex Debug header for programming and debugging.

For powering the board, I added a spot for a CR2032 coin cell battery holder on the bottom. This is a nice solution for testing low-power configurations and/or using the board without power supply wires attached. The supply voltage range of the SAM D09 is 2.4V to 3.6V, and this matches nicely with the output voltage of a CR2032 over its discharge cycle. You can also power the development board with an external power supply by connecting to the VDD and Ground pins on the headers. Make sure to remove the CR2032 battery before connecting an external power supply!

CR2032 battery holder on the bottom of the development board.

Programing the device is quite easy in Atmel Studio. The Atmel ICE integrates nicely with the IDE, and the Atmel Software Framework (ASF) helps you to develop programs rapidly. Programming 32-bit microcontrollers is much more complex than programming 8-bit devices, and a good set of libraries is important when you are getting started. The development board does need to be powered externally for programming. I found that throwing in a coin cell battery to power the SAM D09 and upload my program was quite handy.

Atmel ICE programmer/debugger connected to the development board.

Assemble Your Own


Here is the information you need if you'd like to make your own development boards for the Atmel SAM D09C.

Atmel SAM D09C Development Board: Order PCBs on OSHPark!

Parts List:
  • Microcontroller: Atmel SAM D09C 14SOIC
  • CrystalCitizen CM200C32768
  • Reset ButtonC&K PTS525SM15SMTR2 LFS
  • C1: 47uF 1410 Tantalum SMD capacitor, 10V rated minimum
  • C2, C3: 100nF 0603 Ceramic SMD capacitor
  • C4, C5: 22pF 0603 Ceramic SMD capacitors
  • LEDs: 0805, colors of your choice
  • R1: 10k ohm 0603
  • R2, R3, R4: 560 ohm 0603 (adjust values of R3 and R4 to change brightness of LEDs)
  • Battery Holder: MPD BK-912 CR2032 Holder
  • Debug Header: Amphenol FCI 20021111-00010T4LF
  • Headers: 2x 7 pin standard 0.1" headers (your choice of male or female)
  • Screws and Standoffs: Sized for M3 screws, standoff length is your choice.

Notes: If you want to do away with the power LED for low-power testing, you can also omit R3. The value of R2 is not critical, use whatever value you pick for the LEDs. There are various stability and load capacitance options for the CM200C 32kHz crystal. I picked the +/- 5ppm version with 12.5pF load capacitance.

Assembly Note: Before soldering on the CR2032 holder, tin the square ground pad in the middle of the footprint. It should have a little mound of solder on it to ensure good contact with the battery.


Atmel SAM D09C development board schematic.

Atmel SAM D09C development board layout.

Here's a straight-on shot of the board to help with assembly.

Wrap Up


Let me know if you order PCBs and make your own development boards! This is a fun little board, and I'm looking forward to doing some projects based around this very capable microcontroller.

Please post any questions and comments below.

Thanks for reading!

- Dan W.

LoRa Products Coming from Adafruit!

$
0
0
Over the past couple of months I've been working on bringing LoRa support to the Adafruit Feather line of microcontroller boards. I designed a small Development Breakout FeatherWing for the HopeRF RFM95/96(W) module, as well as the LoRa FeatherWing IOX that uses an I/O expander to drive the numerous pins of the RFM module over I2C.

My boards are of course non-official FeatherWings that can be added as daughterboards to Feathers (similar to shields for Arduinos). Well, it looks like Adafruit has also been working on LoRa products! On a recent episode of their weekly Ask An Engineer web show, Ladyada gave a sneak peak of some boards she has in the works. One looks to be a Feather board with an RFM95W module directly on it. Another board is a breakout for the RFM module.

Prototype of a new "Top Secret" LoRa Feather.

Breakout board for the RFM modules (yellow PCB) along with a tester and a live demo.

This is great news for the LoRa community. As official products, they will be sold in the store and no doubt come with excellent code support and tutorials. Additionally, it will help to integrate LoRa Feathers with other FeatherWings and eliminate the need for a daughterboard just for the module itself.

There was no ETA given on the LoRa products, but with functional prototypes and testers already completed, we shouldn't have to wait long.

Thanks for reading!

- Dan W.

New "Lab" Equipment: Nikon D3300 DSLR

$
0
0
I have needed a good camera for some time now. I've always been interested in photography and owned a couple of film SLRs back in the day, but never made the jump to a DSLR. The cameras in modern smartphones are so good, it's really easy to get by without a proper camera. As of today, however, I have some new equipment in hand to re-kindle an old hobby.

My new Nikon D3300 DSLR.
Photo taken by an iPhone 6S (and heavily post-processed).

Nearly all of the photos on this blog were taken by my iPhone. It has a decent camera, but taking pictures of small objects in indoor lighting can be challenging even with a good set of equipment. Two issues I constantly struggle with are underexposure and white balance. I have to heavily post-process the photos to make them presentable, and even then I can get some very strange color and noise artifacts. Lately I've just been blowing out the white background by cranking up the exposure, and then tweaking the temperature until it it looks "ok".

That all changes today! I am now the proud owner of a Nikon D3300. It is certainly an entry-level DSLR, but it has the features I need at a good price. I'm really looking forward to using it over the next few weeks and re-learning all the things I have forgotten about proper photography. The camera is also capable of recording video at 1080p/60fps. One of my plans for the blog is to launch a YouTube channel and start producing video content. This will be a starting point equipment-wise for getting that up and running.

I can't offer a lot of insight on the camera right now, but I did set up the tripod and take a couple of sample photos.

My Citizen Eco-Drive. Watches are very photogenic, aren't they?

A lovely open-source frequency counter board by Andy Brown.
I need to do a post about this one in the future.

What do you think of the above photos? Both would have been quite difficult to do with the iPhone. I certainly notice huge differences in the raw images but they may not come through in the uploads. I did have to do some post-processing, primarily because of the poor lighting I have available to me. I am planning to purchase a soft box to help with the lighting situation for taking pictures of my projects.

That's all for now. Expect higher quality photos (and videos!) on the blog in the future.

Thanks for reading!

- Dan W.


Fluke/Philips PM66xx Frequency Counter OCXO Upgrade

$
0
0
In this post I will document an OCXO upgrade board I designed for the Fluke/Philips PM66xx line of frequency counters.

Custom OCXO upgrade installed in my Philips PM6674.

Introduction


A few months ago I purchased a Philips PM6674 frequency counter on eBay. It's an older 9 digit counter with two channels that has a maximum input frequency of 550MHz. The design feels dated compared to more modern counters, such as my Agilent 53131A. However, it is still a fully functional piece of lab equipment with a simple user interface and compact design. I often prefer older counters for day-to-day use because I don't have to fuss with complicated menu-based interfaces and features that I don't need. (Set the gate time on a 53131A and count how many button presses it takes).

A nice old frequency counter: The Philips PM6674.

My counter came with the standard XO timebase option, which has fairly poor specs for stability and drift. It is difficult to trim precisely with the single-turn trimmer capacitor on the board. For most testing in my lab I use an external reference from a GPSDO, but it is still nice to have an accurate timebase available in the counter if I need to take it somewhere and do testing away from the bench.

Previously I posted about an OCXO upgrade I made for my Racal-Dana 1992. The fun of designing a similar upgrade for the Philips counter was one of my motivations for purchasing it. My upgrade board is roughly equivalent to the original PM9691 OCXO module, and it should be compatible with any Fluke/Philips counter that is capable of using the option.


Designing an OCXO Upgrade


Creating a timebase upgrade board for the PM6674 was a bit more involved than the process for designing the Racal-Dana upgrade. That counter had a clean 5V supply available on the header where the timebase board connected, which was exactly what I needed for the OCXO. The header for the OCXO module in the Philips counter also has a 5V rail. However, that rail does not stay active when the counter is in standby. The original Philips OCXO modules operated from the 24V rail, and I had to use that for my own upgrade. In my counter, the "24V" rail actually runs at about 27V, and drifts up to 30V when the counter is in standby. There is also a substantial amount of ripple.

I opted for a Recom 78C5.0 DC-DC converter to get the 5V I needed to power my board. This is a nice little module with a pinout that mimics the 7805 linear regulator. It has good specs for efficiency (as high as 96%) and was very easy to implement on my board. I used a combination of electrolytic and ceramic capacitors on the input and output for filtering.

With power taken care of, the remainder of the board is very simple. I used the CTS 10MHz OCXO that I did a teardown on and reverse-engineered the schematic for. This OCXO has a 4V reference available on one of the pins, so I did not need to add a separate reference IC to the design. Additionally, the CTS OCXO has a ~1.4Vpp sine wave output, which is quite compatible with the Philips counters. The input spec for the internal reference signal is 1Vpp into 1kohm.

My take on a modern replacement for the PM969x series of OCXO modules.


The form-factor of my upgrade board mimics the original OCXO module as closely as possible. I found the exact header I needed on Digikey for the mounting arrangement used in the Philips counter, and there is a single hole for a securing screw. The module mounts very nicely in my counter and looks pretty snazzy. The performance of the CTS OCXO is sufficient for the 9-digit resolution of the counter. It warms up quickly and hugely improves the accuracy and usefulness of the counter when it is away from a proper 10MHz external reference.

The CTS OCXO warms up very quickly.


Shared as Open Source Hardware (OSHW)


Fluke/Philips PM66xx OCXO Upgrade: Order PCBs on OSHPark!

Eagle Files: Shared on Github


Schematic of the PM66xx OCXO upgrade board.


Parts List

OCXO: CTS model 1960017 (available on eBay) or compatible substitute
DC-DC Converter: Recom 78C5.0-1.0
C1: 100uF / 50V, 105*C rated electrolytic (8mm diameter)
C2: 2.2uF X7R 0805 50V rated ceramic
C3: 220uF / 35V, 105*C rated electrolytic (8mm diameter)
C4: 10uF X5R 0805 25V rated ceramic
C5, C6: 100nF 0603 ceramic
R1: 51 ohm 1206
VR1:Vishay M64Y103KB40 10k 21 turn pot
Header: Molex 22-14-2104

The ceramic capacitors install on the bottom side of the board.


Installation Note: You need to remove the stock 10MHz crystal when you install this board, but the remaining components of the oscillator circuit can be left in. I simply cut the two legs of the crystal from the top of the board and left it glued in place, as you can see in the first picture in this article. If you ever decide to return the counter to its stock configuration, you can simply reconnect the pins of the crystal with some solder.

Rev A?


Sharp-eyed readers will note that this shared version of the board is Revision B. Well, that begs the question: what happened to Revision A? The original version of the board used a different OCXO, the 1" square NDK unit that I incorporated into my Racal-Dana upgrade. Due to the lack of a voltage reference on that OCXO, I had to incorporate an LM4140 into the design. The square wave output of that unit was also not ideal for the Philips counter. The whole design seemed needlessly complicated to me, especially when I knew I could make a more elegant solution based around the CTS OCXO.

Revision A of the PM66xx OCXO upgrade board. This one didn't make the cut.


Wrap Up


Please let me know if you assemble one of these boards for your counter! I have also provided the Eagle files, so you can modify the board if you like to use a different OCXO footprint. I have an entire case of the CTS OCXOs to use up, so expect some more shared projects that use them in the future.

Thanks for reading!

- Dan W.

Frequency Counter OCXO Upgrade on The Signal Path

$
0
0
Shahriar of The Signal Path Blog posted a YouTube video a few months ago about a Fluke PM6680B frequency counter that he has in his lab. He performed a successful repair on the counter in that episode and got it fully operational. The unit was equipped with the stock XO timebase, however, that did not provide the necessary stability for a counter of that resolution.

I sent him one of my PM66xx OCXO upgrade boards for his unit. Check out his video where he installs and tests the board in his counter.


This upgrade board is shared as open source hardware. If you have a compatible counter and would like to make your own, check out my write-up here.

- Dan W.

10MHz OCXO Teardown (NDK ENE3311A)

$
0
0
Here we go with another OCXO teardown. This time we are taking apart an NDK ENE3311A 10MHz OCXO. This is a little 1" square unit with a square wave output. You can find them on eBay for about $15 USD.

I have a bunch of these on hand, so I don't mind sacrificing one
to learn more about the internal construction.

I cut around the bottom of the can with a dremel.
It eventually came off with little drama.

Not a lot going on inside this unit, eh? Just like in the CTS OCXO,
the oscillator circuit is on the top of the PCB, and the crystal is
bonded to the bottom side.

Close-up view of the top of the PCB, along with annotations of the pinout.

I cut the pins and flipped the board over. Ok! This side is much more interesting.
The little IC in the upper right is the output buffer. One of the SOT-23s on the
left is a voltage regulator. The remaining IC is probably an opamp.

There's a thermal pad and some white goop bonding the crystal to the heater elements.

I scraped away most of the thermal compound and lifted up the crystal.
We have two power devices and two resistors acting as heaters, just as expected.


That's all for this teardown! I might reverse-engineer the schematic for this one as I did with the CTS 1960017 OCXO. However, it's pretty easy to see what is going on inside this unit. Besides getting exact part values and device IDs, there is probably not a lot to be gained. What are your thoughts on the internal construction of the NDK ENE3311A OCXO?

Thanks for reading!

- Dan W.





Learning Embedded Electronics with the ATtiny104 XNANO

$
0
0
In this post I will document a small add-on board that I designed for the Atmel ATtiny104 Xplained NANO. I have also created a series of lessons that use the ATtiny104 XNANO with the add-on board to provide a basic introduction to embedded electronics and programming.

The ATTiny104 XNANO next to the small add-on board I designed to
enable a series of lessons on embedded development.


Introduction


In a previous post I examined the new ATtiny104 microcontroller from Atmel and checked out their evaluation board for it, the ATtiny104 Xplained NANO. I was very impressed by this little board. It has a programmer/debugger built in, allowing it to integrate seamlessly with Atmel Studio 7. You simply connect it to your computer with a USB cable to power the board, develop programs and connect to the USART. It is a great bargain at less than $5 USD.

It is not only suitable for evaluating the ATtiny104 but also for learning and teaching embedded electronics and programming. Certainly there are numerous Arduino and Arduino-like boards available for that task as well. This is just one more option that might be interesting if you need a very low-cost board that integrates with Atmel Studio for programming in standard C.

I designed a small add-on board for the ATtiny104 XNANO that includes a 5mm LED, a trimpot, and a photoresistor. The LED goes to one of the PWM-capable pins on the microcontroller, and the outputs of the trimpot and photoresistor circuit can be read using the ADC. These components combined with the on-board push button and LED allow for many lessons and projects to be completed. It's a very small and low-cost combo for learning or teaching embedded development.

The add-on board connected to the ATtiny104 Xplained Nano.

Lessons


To support the use of the add-on board, I have created a 28-page guide with eight lessons on basic embedded programming. The lessons walk you through using various features of the microcontroller and add-on board, including: digital inputs and outputs, the ADC, PWM output, USART, and interrupts. They are designed for someone that knows a little about electronics and programming, probably with an Arduino, and wants to get a feel for programming in Atmel Studio in standard C.

The guide to support the add-on board includes eight lessons on basic embedded development.


Add-On Board Kits


The add-on board makes for a very nice first soldering kit. The PCB is cheap ($6 USD for three copies from OSHPark) and the parts are very common, through-hole components. You probably already have all of this stuff on hand. The part outlines and resistor values are shown in the silk screen of the board so you don't even need to consult a schematic while assembling it.

ATtiny104 Xplained NANO boards can be acquired from distributors such as Digikey and Mouser. The PCBs can be ordered from OSHPark. Finally, the parts can be ordered from an online vendor such as Sparkfun

Lesson #1 in the guide is soldering together your add-on board kit!


Motivation


Let me say now that this is not a Kickstarter or anything like that. I'm not planning to sell these kits or make any money off of the guide. The add-on board is Open Source Hardware, and the guide is released under the Creative Commons Attribution-Share Alike 3.0 license. I hope that the board and guide are useful for learning a little bit about programming microcontrollers and embedded design, whether that is for an individual reading this blog or someone that might use the board for a workshop or class. Feel free to modify and redistribute the guide to suit your needs, as long as you attribute and share it back to the community under the same license. I have also shared the Eagle files for the add-on board if you'd like to customize it.

Check out the guide to learn more about the lessons and what you can do with this add-on board.


Shared as Open Source Hardware (OSHW)


ATtiny104 Xplained NANO Add-On Board: Order PCBs on OSHpark!

Eagle Files and Lesson Guide: Shared on Github

Schematic for the ATtiny104 XNANO Add-On Board

Parts list:

Note: There are no component IDs in the silkscreen, but the outlines and resistor values are shown to clearly indicate where the parts go.

Headers on XNANO: I have noticed that one of the capacitors on the ATtiny104 XNANO board is a little too close to the header pins. Male headers might not seat all the way flush against the board. Luckily there is an easy fix. Use a file to slightly round the bottom corner of the header where it hits the capacitor. Just a few swipes with the file will allow it to seat fully. Also, I used male headers on the XNANO board and female headers for the add-on board, but you can reverse that if you like.


After you finish the lessons and remove the add-on board, many additional
projects can be completed with the ATtiny104 XNANO.


Wrap Up


I hope that you find this small add-on board for the ATtiny104 XNANO and the lesson guide useful. If you assemble one and work through the lessons, or use them in a class or workshop, please let me know. Also, please post any questions and comments down below.

Thanks for reading!

- Dan W.


Quick PCB: TCXO Breakout

$
0
0
I'm back with another Quick PCB. This one is a little breadboard-compatible breakout board for inexpensive temperature-compensated crystal oscillator (TCXO) modules commonly found on eBay.

Need a TCXO frequency reference for your breadboard project?
This might be a good option for you.

Introduction


There are some good, inexpensive TCXO modules on eBay that come in the slightly unusual package shown above. This breakout board allows you to mount one of the modules onto the small PCB and adapt it to standard 0.1" breadboard-compatible headers. I have also included a few optional SMD components. There are spots for a power LED, a bypass capacitor on the supply rail, and a capacitor on the control voltage input.

Some of these modules don't actually have a control voltage input on pin #1. Typically they have a small trimmer on top for adjusting the frequency, which is probably more useful for how these are commonly used. If you have access to a disciplined frequency reference such as a GPSDO, you should allow the module to warm up for 24 hours and then trim the frequency.

I have tested this board with two such TCXO modules from eBay. One is a 20MHz Raltron unit that is quite useful for microcontroller projects. You could also use a D flip-flop to divide it to 10MHz. The other is a 14.4MHz Rakon unit. Other modules in the same package will work. I honestly don't know what the package is called, so if YOU do please let me know in the comments below.

Assemble Your Own


Eagle Files: Shared on Github
TCXO Breakout Board: Order PCBs on OSHPark!

TCXO Breakout Board Schematic

TCXO Breakout Board Layout
Sharp-eyed readers will note this has been updated from the boards shown above.
The circuit is the same but the layout is much cleaner.

Parts List:


TCXO Module: Raltron RTX0230LC, Rakon VTX0525-14.4MHz, or similar
C1: 100nF 0603 SMD
C2: 10nF 0603 SMD (Only necessary if your module has VFC on pin #1)
R1: 1k 0603 SMD (or adjust value to change brightness of LED)
PWR LED: 0805 SMD (color of your choice)
Headers: Four 2x1 0.1" standard male headers (snap off from breakaway strips)

Note: The outer-most pins on each header are not connected to anything. They are just there for stability on the breadboard.

Sine to Square Wave?


Many of these modules output a relatively weak sine wave. However, you probably need a logic-level square wave for your project. You can use the circuit shown below to convert the sine wave output to a square wave. Note that you may need to adjust the resistor divider values based on the output signal of your module and the inverter you use. The peak-to-peak output from the TCXO needs to extend past the High and Low logic thresholds of the inverter to successfully trigger it. The divider also adjusts the duty cycle of the output.

Use a schmitt inverter chip with TTL-compatible inputs. I use 74LVC chips exclusively for my projects. 74ACT is another good series. If you want to be really old school, find those 74Fs in the junk box.

A typical circuit for converting a sine wave signal to a logic-level square wave. 

Wrap Up


I hope this little breakout board is useful to you! Tweet me a pic @sync_channel if you build one into a project.

Thanks for reading!

- Dan W.

Designing a Mains Frequency Monitor, Part 1

$
0
0
This is the first in a series of posts about designing a mains frequency monitor using the Microchip PIC 16F1619 microcontroller. Today we will talk about the features of this device that make it a good choice for such a project. We will also start to piece together our circuit, program, and test a prototype on the breadboard.

Prototype of a mains frequency monitor using the PIC 16F1619.

Introduction


Many people assume that the mains frequency is exactly 50/60Hz, but in fact that is rarely true. Accuracy and stability of the mains frequency is an interesting topic to research. No two points on the grid will have exactly the same characteristics, so collecting data at your location can reveal some interesting findings. This is especially true if you have (or are interested in building) a mains-referenced clock. There are many industrial applications as well for such a project.

Numerous circuits and methods have been published for monitoring the mains frequency. Recently, I came across the PIC 16F1619 microcontroller and thought it would be a great device to design my own solution around. It is a very inexpensive chip that comes in a DIP package, making it breadboard-friendly for prototyping. This PIC has an interesting set of features including a Zero Crossing Detector (ZCD), a Signal Measurement Timer (SMT), and an Angular Timer. It also includes several 16-bit timers, configurable logic cells, a PID math accelerator, a hardware USART, and lots more. Check out the datasheet for this device to learn more.

Pinout of the 16F1619 in a 20-pin PDIP/SOIC/SSOP package.

Zero Crossing Detector


The first peripheral we will examine in more detail is the ZCD. It allows the detection of both the positive- and negative-going zero crossings of the input signal. Additionally, the output of the ZCD can be used as an input to another peripheral such as the SMT for gating and windowing. Externally, it requires only a single series resistor to limit the current into the module. Additional pull-up and pull-down resistors can be added to correct the offset on the comparator reference voltage or intentionally set an offset from true 0V. Check out this Technical Brief to learn more about the capabilities and setup of the module.

Block diagram of the ZCD module.

Scope capture of an AC input signal (blue) and ZCD output signal (yellow).
The output is also accessible in an internal register for triggering other peripherals.

Signal Measurement Timer


The SMT is a flexible 24-bit timer with many options for clocking, windowing, and gating. Check out the Technical Brief to learn more about it. We can use it to measure the relatively long cycles of the mains signal at full system clock speed and still not overrun the timer. Combined with the ZCD it gives us a means for measuring the mains frequency to a suitable level of precision. With the core functionality needed for our project handled by integrated peripherals, we save our code space for processing the data and feeding it out to another device for monitoring and logging.

Block diagram of the SMT module.

Angular Timer


Another really cool peripheral in the 16F1619 is the Angular Timer. It locks onto the input signal and allows the instantaneous phase angle to be determined at any point during the cycle. It can also be used for missed pulse detection. This peripheral relies on several registers and configuration bits, but once set up it is easy to use. You simply read out the value of the phase clock during a cycle to calculate the angle. This peripheral has many potential uses for mains applications and motor control. Microchip has a webpage on it with more information, documentation, and a video.

Designing the Circuit and Firmware


With the above three peripherals in mind, I started working on my circuit design for the project and building a prototype on the breadboard. I added a 20MHz TCXO to generate a stable, accurate clock for the microcontroller and timers. For the mains input, I used a 12V AC wall adapter. This goes into a half-wave rectifier and then a voltage regulator to generate VDD. The mains signal to be measured is tapped off before the rectifier, bringing it into the ZCD with a common ground reference. I might explore upgrading to a center-tapped full-wave rectifier in the future.

Below is a partial schematic for the circuit thus far.

The beginnings of a mains frequency monitor circuit.

The firmware came together quickly in MPLAB X IDE. I set up the various peripherals and put the SMT into Windowed Measure mode. The window is triggered by the internal ZCD output bit. When a positive-going zero crossing is detected, the SMT beginning counting at the full 20MHz system clock speed. At the end of the cycle the count is latched into a register and then stored. Once measurements for 60 cycles are accumulated, the average frequency during the second is calculated and printed via USART to an LCD display.

I didn't actually need the Angular Timer in my project, but it's such a cool peripheral I wanted to find some way to include it. I decided to use it to verify that the negative-going zero crossing occurs at the correct phase angle. That angle is of course 180 degrees (assuming a symmetric waveform). The ZCD generates an interrupt at the zero crossing and the program checks the count in the phase timer. If the phase angle is not correct, an error flag is set. Currently I just use this to set a status LED, but there is a lot more that could be done with it. In the future I might use it to detect erroneous measurements and automatically remove them before they get ingested into my data.

This hardware and firmware setup also gives us the basis for a mains-referenced clock, where the time is incremented every 60 cycles. This was a very simple addition to the code but I think it adds a lot to the project. The mains frequency in my area tends to run about 10 mHz fast, and sure enough the clock runs fast with drift that matches calculations.

The prototype on the breadboard works well, and you can see a picture of it at the top of this article. My initial testing against proper frequency counters shows that the design so far meets my expectations.

Lots More To Do


The project is coming along well, but we have a lot more to do before it is done. In Part 2, we will finish the firmware, finalize the schematic, and design a PCB for it. We will also need to do a lot of testing to verify the performance of the counter.

I have uploaded the program in its current state to a new Github repo. Please check it out if you are interested in seeing what the code looks like. This repo will also house the PCB design files and other documentation in the future.

If you have feedback and suggestions on this project, please post them in the comments below. A post on Part 2 of the project will be coming in a couple of weeks.

Thanks for reading!

- Dan W.

Cherry MX Keypad

$
0
0
In this post I will document an open-source, Arduino-compatible Cherry MX keypad that I designed using the ATmega32U4 microcontroller.

 A highly customizable Cherry MX keypad.

Introduction


You have probably heard of Cherry MX keys in relation to gaming keyboards. They are very nice keys with excellent tactile feel. They are also extremely durable and rated for 50 million keystrokes. Products that use them are often top-tier and pricey, but come with cool features like multi-colored backlighting and re-programmable keys. Many people customize their keyboards by changing the key caps to have custom labels and colors. But why stop there? Let's design our own Cherry MX keypad from scratch!

Board Overview


The board that I designed includes four Cherry MX keys. I used MX Blues, but it is also compatible with other types such as Brown and Red. It's simply a matter of soldering on the ones you want. The keys are backlit by 3mm LEDs that sit in recesses in the sides of the keys. They are controlled via PWM to allow changing the brightness. The microcontroller running the show is an Atmel ATmega32U4. This is the same microcontroller used on the Arduino Leonardo. In fact, this board looks like a Leonardo to the Arduino IDE for programming. There is an ISP port for burning the bootloader with a programmer (Atmel ICE, USBtinyISP, etc), but you only need to do that once. Afterwards simply connect the board to your computer using the Micro USB connector for programming and normal usage.

The lovely ATmega32U4. Adding USB to the project with this chip couldn't be simpler.


The left side of the board with the microcontroller is a good example of a minimal setup for the 32U4. Despite the small number of components, we still have a good 16MHz crystal, reverse polarity protection on the 5V USB line, and the necessary bypass capacitors. If you modify this board to add more keys, you can bring over most of this layout as-is.

Usage


Using this board is super easy. After flashing the Leonardo bootloader, you can upload the example program on Github over USB from the Arduino IDE. You'll see from the example sketch that the code is simple and easy to modify. After uploading a program, the board immediately re-mounts as a USB input device. Pressing the keys sends the characters you have programmed to the computer just as if it were a keyboard or mouse. You could also program in character strings and complex combinations of key presses, mouse clicks, and delays. See this reference on the Arduino page to learn about all of the keyboard and mouse commands that you can use to program your own key functions.

Check out my YouTube video on the Cherry MX keypad to see it in action:


Customization


Not only is the programming of the keypad entirely customizable, the hardware is as well. This is shared as an open-source project. You can use the Eagle files as a template to make your own numeric keypad or even a full keyboard! Adding Cherry MX keys to your project really steps it up a level, especially if you create or 3D print a nice enclosure to mount them in. Remember that these keys are not just about tactile feel. They are extremely durable, and you can purchase or make your own custom keycaps to add the finishing touches to your project's interface.

Using Cherry MX keys in this project gives us access to all of the awesome
custom keycaps available. These metal arrow keys look and feel great.


I used the internal pull-ups on the 32U4 for the key switch circuits, and debouncing is done in software. There is plenty of space around the keys on the board for adding hardware debouncing if you like.

With only four keys on the board, I was able to connect each one to an individual pin of the microcontroller. However, if you make a large board with several keys, this will not be possible. You will need to switch over to row-and-column scanning to be able to handle something like a full keyboard. There are also some interesting things you could do with the backlighting. You could put the LEDs on a parallel charlieplexed grid, allowing you to turn on individual ones. This would be useful for key press indication, making games like Simon Says, and adding cool lighting effects.

Shared as Open Source Hardware (OSHW)


Here's the information you need to assemble your own Cherry MX keypads using the PCB I designed or design your own.

Eagle Files and Example Program: Shared on Github
Cherry MX Keypad: Order PCBs on OSHPark!

Cherry MX Keypad Schematic

 Cherry MX Keypad Layout

Parts List:


Microcontroller:Atmel Atmega32U4 TQFP
LEDs: 4x 3mm Green (or substitute with LEDs that have the same compact dimensions)
USB Connector: FCI 10103594-0001LF
D1: BAT20J or similar schottky diode, SOD-323 package
Q1: MMBT2222A NPN transistor, SOT-23 or similar NPN with same footprint
Y1: 16MHz, 5x3.2mm 4-lead SMD crystal
Programming Header: Standard AVR ISP 2x3 0.1" header (no need to actually solder it)
C1: 4.7uF 0603 SMD
C2: 100nF 0603 SMD
C3: 1uF 0603 SMD
C4, C5: 22pF 0603 SMD (or adjust value based on crystal load capacitance)
R1: 10k 0603 SMD
R2, R3: 20 ohm or 22 ohm 0603 SMD
R4, R5, R6, R7: 330 ohm 0603

Notes: Be sure to get the "PCB Mount" version of the Cherry MX keys, such as the part numbers shown in the links above. They have the necessary "fixation pins" for stability on the board. The 3mm LED needs to have a very small rim and short height to seat fully into the side of the MX key body. Any substitute needs to have similar dimensions to the part number linked above or it may protrude above the key body and interfere with the keycap.

Soldering Note: Be sure to examine the pictures, footprints, and part dimensions to ensure you can successfully assemble this board. I did use hot air for the crystal and USB connector. They can be done with an iron, but hot air and solder paste is more reliable.

Wrap Up


I hope you find this project interesting. As I said, it is really just a template for designing your own Cherry MX keypad. You can modify it to make it easier to solder, expand the board to include many more keys, or customize it to your intended enclosure. Tweet me a picture @sync_channel if you make some of these boards or design your own custom Cherry MX keypad. I'd love to see it!

Also let me know what you thought of the YouTube video. I have wanted to add video content to my articles for some time, and this is a first attempt at it. I have nothing close to a proper setup for making videos, so I apologize for the poor quality. Perhaps in the future I will invest in some better lighting and equipment to improve my videos. This written blog will always be my primary means of sharing my projects however.

Thanks for reading!

- Dan W.

Designing a Mains Frequency Monitor, Part 2

$
0
0
This is the second in a series of posts about designing a mains frequency monitor using the Microchip PIC 16F1619 microcontroller. In this post we will take a look at the first revision of the board that I designed for the project and some of the features that it adds.

Be sure to read Part 1 of the project write-up if you haven't done so already.


First revision of the Mains Frequency Monitor board.


PCB Progress


I designed a PCB for this project a couple of weeks ago, and recently received the boards back from OSHPark. I think it turned out great! The board houses the microcontroller and 20MHz TCXO that we discussed in Part 1. For the power supply I opted for a Recom DC-DC converter to generate 5V from the rectified input from a 12V AC wall adapter. There is a programming port (PicKit3 compatible) for programming the microcontroller as well as a header to hook up the LCD.

I also added an opto-isolated terminal port that is compatible with common Serial-to-USB adapters such as the FTDI Friend, FTDI Basic Breakout, and all of the various clones available online. This is nice for capturing data in a log file and then analyzing it in a program such as TimeLab.

The PIC 16F1619 only has one USART, but I wanted to use the same serial LCD display I have been working with throughout the prototyping phase. I also needed the USART for the terminal interface. To get around this I added a SPDT analog switch (74LVC1G3157) to allow sharing of the USART with both ports. The serial LCD only needs the Tx line, so the Rx line from the USART connects directly to the terminal port.


 The Mains Frequency Monitor has three ports: programming, Serial LCD,
and an opto-isolated terminal port for data logging.

Here's a short video showing two of the boards in operation:


Performance


With assembled PCBs to test, I have been able to collect some data. Here is a frequency difference plot in TimeLab for a 12 hour run:

 Mains Frequency, 12 Hour Run, Frequency Difference

And here is the ADEV plot for the same run:


Mains Frequency, 12 Hour Run, ADEV

Much longer runs will be required in the future. Also, I plan to rig up a test with the board and a proper frequency counter measuring the same signal to allow for a good assessment of the board's performance. I've done some informal comparisons with a calibrated counter and I'm very confident in the accuracy of the readings from the board.

Design Files


I plan to wait until the project is finished before creating a project link on OSHPark, publishing the BOM, etc. Rev A of the board is working out well, but it might still be necessary to make some changes. Don't worry, everything will be shared and documented fully in Part 3 when we wrap up. For now, the design files are available in the GitHub repo if you would like to check them out. I have also updated the firmware version in the repo.
 
Here's the schematic of Revision A:

 Mains Frequency Monitor Revision A Schematic


Mains Frequency Monitor Revision A Layout


Measuring frequencies is fun for the whole family!


Conclusion


That's it for Part 2! I had hoped to make more progress on the firmware in this post, but the hardware took most of my time. I'm very happy with how the board turned out however. In Part 3, we will work on the code, sort out the clock functionality, and get the project finished up.

Please post any comments, suggestions, and feedback below.

Thanks for reading!

- Dan W.

Eagle Custom Parts Library

$
0
0
I've created a new Eagle custom parts library for the projects I post on this blog. Though I upload the design files for individual Open-Source projects, you might like to re-use some of the parts in your own projects with a standalone, documented library. I have several parts to bring over, clean up, and comment, so it will be growing quite a bit over the next few weeks.

You can check it out on Github here:

Sync Channel Blog Design Files on Github


Ready-to-use Eagle footprints.

I will include Digikey part numbers where possible. I will only add parts to this library that I have personally tested using the OSH Park PCB service. I may also add other random things to this repo in the future. Note that I have released everything in it under the Creative Commons Zero license. Therefore, you do not have to attribute to use these in your own projects. OSHW licensing can be confusing at times, so at least you don't have to worry about this library.

Thanks for reading!

- Dan W.

LoRaWAN FeatherWing for Adafruit Feather

$
0
0
In this post I will document a new custom FeatherWing I have designed to add the MicroChip RN2483/RN2903 LoRaWAN module to Adafruit Feather.

Help your Feather fly into the IoT clouds with this awesome
LoRaWAN module from MicroChip.


Introduction


I have designed some FeatherWings in the past to add a LoRa transceiver module to Feather. I did the LoRa FeatherWing Development Breakout and the LoRa FeatherWing IOX that used the HopeRF RFM95/96(W) modules. The RFM modules are small and cheap, which is great for IoT projects. However, they have a limitation if you want to use them with LoRaWAN: the stack is not implemented in the module, leaving that burden to the microcontroller. The LoRaWAN stack takes a fair amount of code space, and it's difficult to implement in some 8-bit microcontrollers.

This new FeatherWing uses the RN2483 (868 MHz) or RN2903 (915 MHz) from MicroChip. It's an excellent module that fully implements the LoRaWAN stack itself. The microcontroller talks to it over USART with a simple command structure to configure it and send/receive messages. The module also has several GPIO pins available. This is the preferred module on The Things Network, and there are a lot of great example projects and code on the Internet to help you get started.

My FeatherWing is very simple. It connects the module serial pins and the module Reset pin to the Feather. It has an SMA connector for attaching an antenna, and a small white silk-screen box for writing in a node ID or other information. GPIO10 from the RN module is attached to an LED for status indication. Finally, I added an ICSP connector for the module that is compatible with the PicKit3. You'll probably never need this, but it can be used to update the firmware on the module if that is ever necessary.

Challenges


Despite the simplicity of the FeatherWing, there was a unique challenge along the way. The RN module is a bit wide, and in fact nearly as wide as the header spacing on the Feather boards. My first revision of this board used a very narrow footprint for the module and normal through-hole headers. It was extremely difficult to solder. Though I made two functional boards with that PCB, I didn't think it was suitable to release as a shared project.

My solution was to make the FeatherWing a bit wider (1" wide instead of the normal 0.9") and use surface mount headers on the bottom. This is the first "wide-body" FeatherWing that I have seen.

 Surface mount headers on the bottom of the LoRaWAN FeatherWing.
Notice that the board is a bit wider than normal FeatherWings.

Compatability


This board is compatible with Feather M0, Feather 32U4, and Feather WICED.

It is NOT compatible (as-is) with Feather HUZZAH (ESP8266). The single hardware USART on the HUZZAH is tied to the USB-Serial chip, and other things shouldn't be connected to those pins. If you really want to use the HUZZAH, you can:
  • Pick a software serial library for ESP8266
  • Download the Eagle design files
  • Modify the board so that the serial pins from the RN module go to the pins you want to use for software serial
  • Order your custom PCB on OSH Park or whatever service you like

Because this FeatherWing is wider than normal FeatherWings, it probably won't work on a Doubler. The board will overlap with the Feather and prevent it from being fully seated.

Shared as Open Source Hardware (OSHW)


Eagle Files: Shared on Github
Grab my Eagle parts library if you want to edit the footprints: Shared on Github

LoRaWAN FeatherWing: Order PCBs on OSH Park!

LoRaWAN FeatherWing Schematic

LoRaWAN FeatherWing Board Layout
 
Parts List:

LoRaWAN Module: MicroChip RN2483 (868 MHz) or RN2903 (915 MHz)
RF Connector: SMA or RP-SMA Edge-Launch for 1.6mm/0.062" board thickness
12-pin Header: 0.1" SMD, Female (Digikey) or make your own Male connector (see below)
16-pin Header: 0.1" SMD, Female (Digikey) or make your own Male connector (see below)
R1, R2: 680 ohm 0603 SMD (or adjust value to change brighness of LED)
PWR, G10 LEDs: 0805 SMD (color of your choice)
C1: 1uF 0603 SMD
C2: 470nF 0603 SMD

Notes: C1 and C2 are located on the bottom of the board. The ICSP header is rarely used and you don't need to solder headers to that. Be sure to pick the correct LoRaWAN module (frequency) for your country/region.

Make Your Own Male Surface Mount Headers


I typically avoid surface mount headers because they are more expensive and not something I have sitting around in the parts bin. Thankfully you can make your own surface mount male headers from right-angle breakway header strips.

Using a pair of pliers, pull every other pin on the header out of the plastic spacer, rotate it 180 degrees, then re-insert it. Next cut the pins a bit shorter so that they fit within the footprint on the PCB. Super easy and cheap. The below picture should make that more clear:

Make your own SMD male headers from right-angle breakway strips.


Software and Usage


These are the pin connections from the RN module to the Feather. On all three of these Feather variants, call "Serial1" to talk to the module instead of "Serial" in the Arduino IDE. The default baud rate is 57600. Drive Reset HIGH to enable the module.

Pin connections for Feather M0, 32U4 and WICED.

Here are some good software examples available on the Internet for using this module:
  • Great blog post on using the RN2483/2903 in Peer-to-Peer mode. This is useful for testing your boards and learning about the command interface to the modules.
  • Write-up on taking the next step into LoRaWAN and making a TTN node. The software is shared on Github.
  • This is the Command Reference for the RN modules. Definitely download a copy of this.
Finally, the status LED on the LoRaWAN FeatherWing is connected to a GPIO pin on the RN module, not the Feather. If you can make it blink with your program, that is great confirmation that the module is operational and talking to the Feather. The command is "sys set pindig GPIO10 1" to turn it on and "sys set pindig GPIO10 0" to turn it off.

Conclusion


This was a long post for a simple board! I hope you find this little FeatherWing useful. If you have any questions or feedback please post in the comments below. Finally, if you make your own LoRaWAN FeatherWing definitely tweet me a picture @sync_channel.

Thanks for reading!

- Dan W.

Atmel Retrokit SAM D Edition

$
0
0
In this post I will document an update that I designed of a classic AVR board: The Retrokit!

Atmel Retrokit SAM D Edition

Introduction


I don't have a lot of information on the original Retrokit board. Based on a post by Jo Uthus on Twitter, it was designed in 1997 by Vegard Wollan. The intent was clearly to demonstrate the speed of AVR microcontrollers compared to other 8-bit devices of the era: PIC microcontrollers, the HC08, and the 8051. The four LEDs on the board blinked at different rates, with the faster AVR completing its blinks first. Of course, the entire board was controlled by a single AVR device which simulated the comparative speeds of the other devices through the blinking LEDs.

The Original Retrokit

There was a 2008 re-design of the Retrokit that Jo posted about. The re-make is a really nice SMT design, and there is even a YouTube video showing it in action! It was posted by Joseph Rautenbach and he is possibly the designer. If you see this Joseph, let me know and I'll link in more information about you.

2008 Re-design of the Retrokit

YouTube video on the 2008 re-design of the Retrokit.

Updating the Retrokit to 32-Bit


A lot has changed in the past 19 years since the original Retrokit was designed. We now have a plethora of 16- and 32-bit microcontrollers available to us with speeds and feature sets that far surpass their 8-bit brethren. The devices you can purchase these days for very little cost offer amazing capabilities. Microchip Technology and Atmel, once competitors, have joined forces. The maker movement has exploded. Arduino happened... It's a great time to be a maker and embedded developer. I thought it was time to bring the Retrokit along for the ride.

I created a 2016 re-design of the Retrokit that uses the Atmel SAM D09 microcontroller. This is an excellent 32-bit device that comes in a SOIC package, making it easy to solder. I mimicked the board size and layout of the first Retrokit as closely as possible. The four LEDs are meant to show a comparison in speed between the 32-bit SAM D device, the 16-bit ATxmega, the 8-bit AVR, and the 8-bit PIC microcontroller. There are a lot of devices to select from in each of those families, and if we wanted to be really picky, I could have even chosen a PIC that blew away the little SAM D09. However, I chose representative devices in each category that also demonstrate the development of microcontroller technology over time, from the older PIC 16F series to the modern 32-bit SAM Ds.

The blink rates of the LEDs and completion times are based on MIPS/DMIPS scores for each device. Check out my code on Github linked below to learn more. Here is a video of the Retrokit SAM D Edition in action:

YouTube video showing my Retrokit SAM D Edition board in action.

The blinking LED demo takes 10 seconds to complete, after which the LEDs all stay lit for an additional 5 seconds. After that, the SAM D09 goes into deep sleep mode to save power. Current draw in deep sleep mode is around 2uA, meaning that the CR2032 battery will last a long, long time in that state. To reactive the light show, simply press the Reset button.

Shared as Open Source Hardware (OSHW)


Here is all of the information you need to order PCBs and assemble your own Retrokit SAM D Edition boards or modify the design.

Eagle Files and Firmware: Shared on Github
Atmel Retrokit SAM D Edition: Order PCBs on OSH Park!

Retrokit SAM D Edition Schematic

Parts List

Microcontroller:Atmel SAMD09C13A
Push Button: SPST Though-hole
Bussed Resistor:470 ohm 5SIP
LEDs: 4x 3mm Red LEDs
Battery Holder:CR2032 Though-hole
R1: 10k ohm 0805 SMD
R2: 100 ohm 0805 SMD
C1: 100nF Ceramic Through-hole, 0.1" lead spacing
C2: 100nF 0805 SMD
Programming Header:10-pin 0.050" (don't solder this, see note below)

Assembly Note: Tin the square ground pad in the middle of the battery holder footprint before soldering on the holder. The pad should have a little mound of solder on it to make good contact with the battery.

Programming Note: The 10-pin Cortex Debug port is positioned directly underneath the microcontroller so that it is not visible from the front of the board. The connector is not meant to be soldered. After assembling everything else on the board, throw in a CR2032 battery to power it and insert the male 10-pin connector into the female end of the cable from your programmer (such as an Atmel ICE). Then, wedge the connector into the port to program it. Finger pressure will keep it in place for the few seconds needed to flash the firmware, and then you should never need it again.

Conclusion


I hope you enjoy this little re-make of the classic Retrokit. If you assemble your own, please Tweet me a picture @sync_channel. Questions and comments are welcome below.

Thanks for reading!

- Dan W.
Viewing all 38 articles
Browse latest View live