Tag Archives: prototype

How to Design a Cheap Plant Watering Sensor (Part 4)

This is the fourth part of the meta-tutorial, where I talk about designing a cheap plant watering sensor. If you did not already read the firstsecond and third part please do it now. These parts contain a lot information which lead to this point of the tutorial.

The third part ended with step 18, planing the final firmware. There a decision was made about the language and style of the firmware. This article will focus on the code of the firmware itself.

Step 19: Write a Preliminary Firmware

In order to be able to do some final tests with the prototypes and be able to work on the final PCB, I need a firmware which is is very close to the final one. In the Atmel Studio, I start a new C++ project in a new folder.

The first thing I do is checking the chosen compiler options for the project. Everything looks reasonable, I just add the option --std=c++11 to the C++ compiler options to get the latest language features.

In a section below I will describe all modules I wrote and will point details about the functions. I obviously did not wrote the whole firmware sequentially in that order, instead I use a incremental approach to develop the software:

  1. Create empty frameworks for all modules.
    • Create a header and implementation file for each module with the correct name.
    • Add the header comments, the namespace, #pragma once and the #include for the own header file.
    • At this point, each module should be ready, so I can easily add new functions to each module.
  2. Start with the hardware module.
    • Write the initialisation for the hardware, like CPU speed, port directions and other important stuff.
    • Layout the interface for the hardware module and prepare empty implementation blocks to be filled with code.
    • At each place where code is missing, I write a comment // FIXME!! to be reminded that there is something missing.
  3. Start the logic module.
    • Write the main entry point of the logic.
    • Call this entry point in the main() method of the firmware.
    • Add the hardware initialisation to the logic.

At this point, I have the structure of the firmware prepared as planed. This structure will lead me through the development process. Continue reading How to Design a Cheap Plant Watering Sensor (Part 4)

How to Design a Cheap Plant Watering Sensor (Part 3)

This is the third part of the meta-tutorial, where I talk about designing a cheap plant watering sensor. If you did not already read the first and second part, please do it now. These parts contain a lot information which lead to this point of the tutorial.

The second part ended with step 14, designing a first prototype PCB. So let us start with the next steps in this journey. This article will be the smooth transition from prototyping to the initial planing for a final design.

Step 15: Assemble and Check the Prototype

After receiving the prototype PCBs from OSH Park, I assemble one completely, including the cable and with one of the sensor plate prototypes as foot part.

Set the Fuses of the Microcontroller

The microcontroller ATtiny13A requires programming using SPI before it can be soldered to the board. There are special bits in the memory, called “fuses”, which control very basic settings of the chip. One of this fuse controls if the chip can be programmed and debugged via the debugWire protocol. This protocol just uses one single wire to program and debug the chip, bus has to be enabled first.

So I put the microcontroller into the programming adapter and connect everything via the Atmel ICE to the computer.

lucky-resistor-1 Continue reading How to Design a Cheap Plant Watering Sensor (Part 3)

Plant Watering Sensor – Precise Current Measurement

As I wrote in the first part of my article, how to design a cheap plant watering sensor, I had troubles to get exact measurements of the current, using my Testo multimeter. I searched for a solution and found the µCurrent Gold device, from David L. Jones known for the EEVblog. Later a little bit more about the device, first the measurements.

plantsensor-current-1

I could do the measurements using the oscilloscope and not only measure the static current consumption, but the current consumption over time. The graph shown in the diagram, is the reading of if the sensor does one single measurement and flashes the LED. Continue reading Plant Watering Sensor – Precise Current Measurement

How to Design a Cheap Plant Watering Sensor (Part 2)

This is the second part of the meta-tutorial, where I talk about designing a cheap plant watering sensor. If you did not already read the first part, please do it now. It contains a lot information about constraints and decisions made which lead to this point.

The first part ended with step 11, building a working prototype with the selected key components. So let us start with the next steps in this journey.

Step 12: Analyse and Measure the Prototype

Never forget why you actually built a prototype. It is your tool to verify all assumptions you made in the design phase. To do this you need the right measuring instruments.

The Power Usage

I start measuring the current of the circuit. This will show if my assumptions about the battery life will be true. For this test I use a multimeter which has a good resolution measuring in the µA range. The multimeter I use is the Testo 760-3 which is not a very well known brand. Multimeters are usually really poor at measuring low currents on low voltages, so let us see if this will work.

I also use a Fluke 114, but this one has no current measurement. It is sometimes very handy to have two multimeters, one to measure the voltage and a second one to measure the current.

For the first test I program the MCU to do all the tests in a loop and connect the power directly to the second part of the circuit. Now the power is always on and I can measure the current used by the MCU while doing the measurement.

lucky-resistor-1

Just running, doing the measurement of the oscillator, the second part of the circuit uses at maximum ~1.2mA. This measurement phase should be as short as possible. Later we will analyse the timing. Continue reading How to Design a Cheap Plant Watering Sensor (Part 2)

Outmoded Sequencer Project

I just started an interesting new project: The Outmoded Sequencer Project. It is an minimalistic music machine. You can use a 8×8 “programming” matrix to create simple melodies which are looping endlessly. This melody can be changed while the device is playing it. Here a short demonstration:

The device is divided into several parts as shown here:

Outmoded Sequencer Prototype Legend

My goals for the project were:

  • No microcontroller.
  • Only outmoded, basic and cheap components.
  • As minimalistic as possible.
  • Maximize the fun with these limitations.

Read all details how you can build this sequencer on the project page:

Have fun!