Pages

RC filters and OpAmps (remember those?)

I tested a simple circuit with a low pass RC filter on a 2Hz pulse circuit.



Vout = Vin (1 - exp ^ (-t/RC))

Couldn't get simpler. The Vout was input to AnalogIn of the LPC1768 for ADC conversion. As expected, it was reading intermediate values. (ADC on the pulse was reading only zeros or 1s.) Great! For lack of a respectful oscilloscope, I made do with this test result.

Now to the drawing board.

What could change here to accomodate for a small capacitance value of the sensor (in place of the 470uF)?

1. The reactance of the capacitor is inversely proportional to the input frequency. So to bring that down, I have to increase frequency of the input pulse. 2kHz? 10MHz? Somewhere in between?

2. The capacitance is seemingly low. I ran some simulations on circuitlab (in demo mode) and unfortunately do not have the plots saved. Fortunately though, I quickly made a note of the change in output for different capacitance values.
Vin - pulse of 3.3V, 2MHz
R1 - 100Kohms
Vout max for C1 at 1pF - 2.74V
Vout max for C1 at 5pF - 1V
Vout max for C1 at 10pF - 500mV

3. At this point, since my sensor is un-calibrated, I do not know the min and max capacitance values, changed by soil moisture. In the worst case, it is smaller than 10pF, making it a bit obvious that I now need to design in voltage amplifiers.

Enter OpAmps!!!!!!

Next iteration of this design process will include 2 opamps; one for amplification and the other as voltage follower for reducing output impedance.

A full weekend into this, I am now almost ready to spend on a good simulator. Please leave your suggestions in the comments. I loved circuitlab for the duration I used it - super quick and easy to simulate - but I am not a power user and am loathe to spend that cash on it.

Update: I have bought a month's worth of circuitlab and am loving it. 

Programming Languages - which one is your favorite?

Source: http://spectrum.ieee.org/static/interactive-the-top-programming-languages
Impressive where Python has reached in terms of popularity! And C still rocks!! yayy. #2 is not too bad at all.

Talking about favorites, mine is by far C. It is fast, efficient and great for embedded systems. I know, at the cost of OOP advantages.

What I like about Python is that it is not half as esoteric as Perl and yet claimed to be very extensible. I don't know as my use of Py so far has been limited, without really testing its capabilities. 

The indenting annoys me. Really? Indented programming in the 21st century?

The best part of Python if you ask me is that it uses C for optimized code in its libraries. So there you have it, a great marriage between raw performance and useability. Notwithstanding the fact that Py also lends OOPability. I may have just created a new word - OOPability.

Okay, I relent. The winner of this beauty contest is Python.

Capacitive Sensing Irrigation

Now here's a project I have been working bits and pieces on so far.

The idea: Moisture sensors with mesh networking talk to a main sprinkler-valve controller. Familiar enough.

The twist? Home-made capsense moisture sensors. Super excited about these. Moisture sensors cost a ton. The typical hand-made sensor uses 2 galvanized nails and is resistive. Nails corrode over time and among other problems, require frequent re-calibration. Enter: capsense using a PCB. Terrific idea and most of all, I'll get to play with raw capacitive sensing!

For the test circuit, I will be hard-wiring it up. As the next step, the mesh network sounds like a great idea for sensors to talk to the controller.

For the controller, I'm using a robotics microcontroller - the NXP mbed LPC 1768. The really cool bit is that code compiles online and generates a .bin. To run this on the target, I just need to drop the .bin in its file system and reset the micro-controller. Love it!

Terminal connectivity to mbed: https://mbed.org/handbook/Terminals
For example: screen /dev/tty.usbmodem1412

So far:
  1. Controller: I ran the hello world program on mbed for blinking of LED1 and also a test of analog input
  2. Sensor: Made a 555 pulse generator of 2Hz frequency with (a different) led blinking and connected the moisture sensor to this to create high-pass filter to modulate the output pulse-width. (I will post the circuit diagram on github once it is tested and ready.)
Next step: write an adc program to read the input from the capsense. Connect these 2 (the sensor circuit and the controller) and run tests to my hearts content.

Pan and Tilt kit on its way

I just ordered a pan and tilt system from ServoCity - the SPT100. It can carry up to 10 ounces in weight, which should be sufficient for a bulb (even the smart ones) and a socket.

I intend to use this to control the direction of a light bulb, as opposed to the more typical uses such as camera or airplane. The SPT100 can be hung upside down per spec - exactly what I need!

The project will be developed in phases:
1. Start with one pan & tilt and write/test code to control it using raspberry pi with a servo controller if necessary.
2. Separately plan/design the bulb dimming and color control. Do I:
  • use a packaged solution - such as the super expensive and feature-rich Philips Hue - or 
  • design a limited version myself (good enough for a garage) with a cheaper RGBW led bulb
3. Integrate 1 and 2. If the solution so far is fully home-grown in my garage with no smart bulbs, the connections are bound to be hard-wired. Networking (zigbee, bluetooth, wifi) will happen at a later stage.

4. Scale: What if I wanted 6 bulbs in a room, all individually controlled by the pi?

5. Installation planning: Track lighting system is one possibility to explore