Category Archives: Electronics

Cypress CapSense CY8C20 capacitive sensing with Arduino

For those of you that are looking for cheap, alternative capacitive sensing solutions, here is the CapSense chip from Cypress that I’ve been using for my recent music controller projects. Below you can find the test code Nan Zhao and I put together for CY8C20 a four-input interface. It’s relatively straightforward to use compare with other capacitive sensing solutions and it also supports PWM outputs if what you need is simple. . Like every other capacitive sensing chip, it has a strict design rule. But our star shaped buttons seemed to work pretty well. A few important document you might need from time to time..

CY8C20xx datasheet
an48303 Firmware migration

some Arduino code I wrote for testing - cy8c20 sample code.













Electronic circuit design and component selection

Hello class (and world!),
Here’s my lecture slides for  MAS.S63: Design for DIY Manufacturing. Enjoy!

I tried very hard to put links to all the images I got from the internet. If I missed any reference, please let me know.

Electronic circuit design and component selection

In this lecture, I talked about the following things -
• Test circuit
• Component Selection
• PCB Design
• PCB Manufacturing
• Components Placement

What’s Inside the Black Box? Basic Electronics You Need to Know.

One of my favorite books of all time is “Practical Electronics for Inventors“. I own two copies of this book so I can have one at work and one at home. If you are serious about getting a reference of almost everything you need to know for your own electronics projects, get the book. If you only want to read tutorials and learn some basic concepts about electronics, sensors and  filter design, read on. Below are list of lectures I gave in the past which includes almost everything you need to know about *basic* electronics in my language (which does not involve big words that I can not spell). I’ll write about some of the topics individually later. But for now, I will put my slides here.

Lecture 1 – Electronic Components  [pdf]
Resistors– Ohm’s Law– Resistor in parallel / series– Voltage divider– Wheatstone bridge• Capacitors– Gauss’s Law– Capacitor in parallel / series
• Inductors
• Diodes– Zener diodes
• Transistors
• Op Amps– Ideal model– Comparator / Schmidt trigger– Voltage follower– Non-inverting   Amp / Inverting Amp– Summing / Differential Amplifier

Lecture 2 – Basic Filter Design  [pdf]
• Capacitor (Inductor)
-RC circuit
-Time constant
• Complex numbers -complex plane…
• Decibels (dB) -cut off frequency -half power point -F3dB
•  Filters- Low-pass, high-pass -MFB band-pass filter

Lecture 3 – Sensors and Sensor Design [pdf]
• What is a sensor
• How to read a datasheet
• Example signal conditioning
• Sensing on a surface – Pressure and Force
• Remote Sensing – Detecting “the Field”
• Multi-target or Multi-sensor?


.NET Gadgeteer beginner’s guide

This article is for people who have never used .NET Micro Framework and Visual Studio or building things with .NET Gadgeteer before like me. I documented each step after receiving my kit and everything I did to start a project and have a simple program set up and running (the whole process took about 1.5 hours with the help of Simon Olberding).


Before we start, a quick overview about what this is about- .NET Gadgeteer is a new open source platform based on the use of the .NET Micro Framework. What this really means for me is that I can write higher level code (C#) for a complex electronics project with the .NET framework which supports a real-time debugging environment. I build my own circuit board and chose my favorite microprocessors most of the time in order to adopt the circuit for specific applications. However, Gadgeteer comes with modular peripherals which allow you to plug in and not to worry about the physical connection, power, and modularity in the early stage of your development. It also comes with a powerful ARM processor (on EMX module which contains ARM Processor, Flash, RAM, Ethernet PHY…etc),   which reminds me of the Begalboard which is a hardware platform based on TI ARM-A8 processors.

.NET Gadgeteer provides a nice hardware interfacing platform for electronics hobbyist to build projects that requires more computing power with very little knowledge requirement on the hardware end. The development environment allows you to drag and drop components in a graphic user interface manner and automatically includes the libraries for you.

My step by step tutorial is for people who just received their starter kit and can not wait to plug everything in and make something blink. I found it hard to find a tutorial simply lists all the things one needs to know.

Now, I would like to talk about our experience in setting up a FEZ Spider Starter Kit. .

Setup – software
Things to install – You can find everything from this link –

System preparation
1.  Microsoft Visual C# Express 2010
2.  Microsoft .NET Micro Framework 4.1 SDK
3.  GHI NETMF v4.1 and .NET Gadgeteer Package Feb. 24, 2012

This installs all the necessary SDKs and components.
First Project Settings

Beginners Guide to C# and the.NET Micro Framework

Setup- Hardware

The mainboard (in our case, a FEZ spider 1.0 mainboard) comes with 14 sockets marked with letters.

The first application we tried to setup is as follows

  1. A button that can trigger an event — input device
  2. Being able to draw something on the touchscreen — output device
  3. Reading signals from Pulse Oximeter and temperature/humidity sensors — events

Sockets mapping – First, what you need is the socket mapping diagram -

 The pulse oximeter transmits signals through UART (indicated by the “U” on the sensor board), the button and temperature/ humidity sensor use GPIO pins (indicated by X: 3 GPIO and Y: 5 GPIO) . The LCD is connected with “R”, “G”, “B” and “T” (touchscreen).

The wiring is as the following image.

You also need the power board which connects to “D” – USB device. It’s pretty straightforward once you figure out the letter matching scheme.

Before you continue, make sure when you plug in, you finished the “First Project Settings “ and had successfully pinged the device and set up the project.


Now, we are ready for some action.

First, start visual C#,

File → New Project… select Gadgeteer and then select “.NET Gadgeteer  Application -> ok

Then you should first see the Program.gadgeteer page.

Click the Toolbox on the left side and select your mainboards, GHI Electronics and Seeed sensors. Link things together based on the Letter matching scheme. Once you are done, you will notice that a Program.generated.cs file was generated and all the modules are included and initiated in this file and you are good to go!

Now, switch to Program.cs and start programming your first .NET Gadgeteer project!

The best examples that I found, besides from the example projects,are from the msdn blog written by Kerry Hammil. The example projects can be found under ../Microsoft .NET Micro Framework 4.1/Samples/


How to read a resistor’s value…

Okay, I know it’s really basic and you probably have an app on your iPhone for it.

But I still cannot help to share the great discovery I made last week.
Before that, let’s cover the bases. There are color bands on a through hole resistor and the numbers are arranged in the same way as the color of the rainbows (sort of).

Black Brown Red Orange Yellow Green Blue Violet Grey White …

I always thought those numbers were randomly assigned just because rainbows are pretty until last week.

Long story short, Nan and I blew up a light dimmer while trying to reverse engineer the circuit. After the magic smoke, we tried to figure out exactly which resistor was blown by reading the value of the apparently troubled resistor…

First, we measured it just for fun… and of course, “beeeeep”, said the multimeter (which means it’s a short circuit, zero ohm in multimeter language).

Then, naturally, I tried to read the value to show off the fact that I remember the color of the rainbows.

“Okay, it is black-black-black-black….”