3D Prints: pen holder

Are you looking for an original present for (next) Christmas ? Here it is ! I made a couple of them for relatives and they loved it, so that I am 100% sure about my advertisement for this 3D printed product !

However, printing the parts might be really challenging because of the heterogeneity of the main part profile. Your printer must be well calibrated and cleaned.


Otherwise, you may, after a couple of hours (actually almost 8 hours), get very disappointed with incomplete prints, broken pieces,  unequal density of  filament prints, etc. Like in this unsuccessful attempt

In other words, this print will not only please people around you, it will challenge your printer performances! Ready for this challenge ? Here are the STL files (cube and optional bottom plate which prevents the pens from falling when moving the pen holder).

Enjoy and keep me posted with your own results.

Back to the main topic

Direct Digital Synthesizer (DDS) (Part 8)

Part 12345678, 9

As seen before, the proposed DDS design has its own limitations. The main restriction is caused by the limited frequency from Arduino: 16 MHz for 5 V supplied platforms such as the UNO, and lower frequencies for 3 V supplied platforms such as the Fio. As a consequence, the higher the requested DDS frequency the harshest signal. Next is an example of  a 8 kHz raw signal, as it is output from the VoutA pin from the MCP4921.

In the previous posts, I used a simple filtering capacitor in order to smooth the signal. In more technical terms, I used a very basic passive 1st order low pas filter. Low pass filters let frequencies which are lower than a predicted frequency threshold go through the filter while blocking the higher frequencies. Following the same principle, one can build high pass filters for removing unwanted low frequencies, or band pass filters and band stop filters which are useful for removing AC line residual.

Starting from this basic description, we can deduce that the frequency threshold (aka cornering frequency) is one of the most critical parameters. An other critical parameter is how steep the corner is ! Next plot illustrates how much filtered frequencies are attenuated depending upon the so called order of the filter: the highest the order the steepest the cornering.

Other parameters are of great importance such as the Gain, Q factor as well as the phase shift which are not covered in this post.

In the present example, I choose an active low-pass Butterworth filter, which has a maximally flat amplitude response in its pass-band region. This filter is implemented in a Sallen-Key configuration as shown in the next illustration:

Although this type of filter as unitary gain, R3 and R4 may be chosen adequately in order to set higher gains (Unitary gain is achieved by removing R3 and using a 0 Ohm resistor for R4). Computing R1, R2, C1 and C2 is not an easy task. However various options are available to the designer: on line calculation and freeware applications. Many publications are also available, mainly from electronic component makers. U1 is any rail-to-rail (input and output) high performances op-amp.

As hobbyists, we probably have many more resistor values in stock compared to capacitors. So that the easiest way to calculate the components values is to start with what you have in hands. I decided to go for a pair of 10 nF capacitors which led to a using two 910 Ohms resistors, so close from 1 kOhm that I decided to go for the simplest! Fair enough, here is the resulting signal:

The yellow plot represents the incoming signal while the blue plot represents the filtered signal. One could make two observations: first is the slight attenuation in signal second is the slight phase delay. Both relate to the behavior of this type of filter and have almost no impact on our final objective which is a clean signal generation. On the other hand we now get a remarkably clean sine wave out of the DDS.


Here are a few links which may be useful to you



Direct Digital Synthesizer (DDS) (Part 7)

Part 12345678, 9

A recent project lead me to excavate a quite old DDS design which may be of some interest for you. Instead of using a ladder of resistors, this design features a simple, cheap and yet powerful digital to analog converter. I will later explain why I choose this particular Microchip circuit but for now I will concentrate on its key features.

  • 12-Bit Resolution
  • ±0.2 LSB DNL (typ)
  • ±2 LSB INL (typ)
  • Single (MCP4921) or Dual Channel (MCP4922)
  • Rail-to-Rail Output
  • SPI™ Interface with 20 MHz Clock Support: that’s very convenient for the DDS application
  • Fast Settling Time of 4.5 µs
  • Selectable Unity or 2x Gain Output
  • External VREF Input. In this way you can choose th full range of the output signal
  • 2.7V to 5.5V Single-Supply Operation (n other words it is Uno and Due compatible)

The chip is encapsulated in a convenient PDIP 8 pins package which is very handy for prototyping; its also comes in smaller packages such as  SOIC, MSOP and TSSOP. For more information about the MCP4921, check its datasheet >here<. You may also use the MCP4821 which is almost identical but features a built in reference voltage (2.048 V) check its datasheet >here<.

Note: Five years from now, very few publications were dealing the MCP4921 DAC; after a quick overview on the subject, I realized that many posts cover the subject. However I decided to stick to my original idea as later post will refer to this one.

Driving the MCP4921 DAC is quite easy from a hardware and a software perspective. The picture below illustrates a quick and dirty implementation of the chip using an Arduino Nano and a bread board. All you have to do is to wire the SPI ports properly.

Next is an example of wiring. Real basic: the output swing from GND to the voltage applied to Vref (actually 5 V.

The you may use a couple of simple functions as a starting point: initialize the chip

/* Initialize the chip */
void PlainMCP4921::InitializeMCP4921(uint8_t csPin)
	/* Initialize SPI port */
	/* Record the chip select pin mask */
	_csPinMask = (1 << csPin);
	/* Set chip select pin as an output pin */
	DDRB |= _csPinMask;
	/* Set default state high */
	PORTB |= _csPinMask;

and set require a digital value conversion

/* Write parameters and data; gain is as per HT_GAI_X constants */
void PlainMCP4921::Convert(uint16_t digitalValue, uint8_t gain)
	uint8_t LSB, MSB;
	/* Set parameter bytes */
	/* Set data bytes */
	MSB |= ((digitalValue >> 8) & 0x0F);
	LSB = (digitalValue & 0xFF);
	/* Send data */
	PORTB &= ~_csPinMask; /* Assert converter */
	PORTB |= _csPinMask; /* Deassert converter */

These very simple functions shall be reused in the in the original PlainDDS library and renamed PlainMCP4921. In this way we get an improved version of PlainDDS, now capable of a dynamic range of 12 bits instead of the original 6 bits. However the timer limitations stay the same and the deign fails to achieve high frequencies. However, it is still very convenient for many applications. Next is an example of code which generates a fixed frequency signal:

#include <PlainDDS_MCP4921.h>
#include <PlainSPI.h>

PlainDDS_MCP4921 DDS; /* Create DDS object */

/* Blink control led */
void BlinkLed(uint16_t cycles, uint16_t duration) 
	const uint8_t ledPin = PIND7;
	uint8_t ledPinMask = (1 << PIND7);
	DDRD |= ledPinMask; 
	PORTD &= ~ledPinMask; 
	for (uint8_t i = 0; i < (cycles << 1); i++)	{
		delay(duration >> 1);
		PORTD ^= ledPinMask;

void loop(void)

void setup(void)
	BlinkLed(5, 200);

… where the most difficult part is probably the LED blinker. As usual, the libraries are available as per the arduinoos policy

Next post on same subject



PLD (Part 6)

Part 12345, 6

The PLD features a multipurpose connector mainly dedicated to plugging sensors. This video shows how easy it is to configure a PLD an run an application for  monitoring temperatures.

Back us on Kikstarter

Do you want to know more about HL2, HL2 Panorama and HL2 PLD ? Check this video

Thanks for watching

PLD (Part 5)

Part 123456

HL2 PLD may be used for safety applications too. In this configuration, the PLD is able to detect movements up to 7 m away within and almost 90° view angle. It features a PIR (Passive Infra Red) sensor from Panasonic.

This sensors is available in different sizes depending on the required range; the enclosures are available in white or black. On top of these specifications, various power consumptions are available, ranging from 1 µA to 6 µA. This criteria may be critical regarding the applications and the expected battery life time. More reading on this sensor > here <. Few extra component are required to convert the output signal from the sensor to the PLD: actually a N-channel MOSFET and a pair of resistors.

The sensor is encapsulated in a 3D housing which nicely fit the bottom gland from the PLD. In this way, the sensor can be oriented in any direction in the horizontal plane.

HL2 Panorama features all sorts of widgets: gauges, graphs, text, state buttons and tables. In this case, I used a gauge for the power reserve and a state button for the current state: RAS means “Nothing to declare” in French.

The principle of operation is rather simple and prevents sending useless information on the LPWAN networks. As soon as a movement is detected, the PLD sends a “NOK” status. Then, during a fixed period of time, the PLD will count the number of times it senses a movement. On completion of this fixed time, if no event is in progress, it releases a “OK” status along with the number of movements sensed. In this way you are aware about a presence right away, and on completion of the event you get an idea about how frequent where the movements. As the HL2 PLD is arduino ™ compatible, you can start from there and fine tune the code to your own taste !

Using no power line, no network cable and a small compact device will help you to monitor motions in a distance place for years.

Is this what you need ? Pay a visit to our Kickstarter campaign > here <

Would you like to get the STL file for the sensor housing ? > Here < it is and this is how it looks.

Next post on same subject

3D Printing (Part 12)

Part 1234567891011, 12

3D printing can be tiring for the nerves… For a week or so, I was enable to print full size parts without enduring severe problems such as splitting layers, irregular faces and even gaps. Here is an illustration of the prints before the fix (on top) and after the fix.

The first layers where almost alright and the print was going worst and worst: awful ! I carefully and visually checked the printer and found nothing. It was obvious from the beginning that I faced a feeding problem. Usually, these problems come from clogged nozzle, clogged insulator, etc. So I checked and cleaned the whole filament path: no way. I ran a temperature measurement on the heater block: it was just fine. So what ?

I made the decision to install the printer on my desk and watch it working: “Watch out printer, big brother is watching you”. After few minutes, I heard little “klunks” next to the extrude stepper motor, once in a while. I squeezed the filament and felt that the filament was getting one step backward at each “klunk”. As the wheel was perfectly clean (I never had the least problem on this side) and the pressure mechanism free to move, my thoughts were that I was facing a torque problem. Firmly pressing the filament toward the feeder was helping quite a lot and resulted in a significant improvement of the printing quality. So that I decided to increase the current limit for the extruder driver (Check the procedure here) to 2.5 A which is the maximum rating for the stepper motor (Specifications here). In this way, the stepper motor can cope with the back-pressure from the filament being pushed toward the nozzle. Then I made sure that this increase had no dramatic effect on the motor and I checked it operating temperature using a PIR thermometer has shown here.

The stepper motor temperature stays below 60°C which is just fine. And… tadaaa, the problem has gone away !


PLD (Part 4)

Part 123456

Using the HL2 PLD (Place and Leave Device) is easy and usefull. We ran the earliest tests on… soil moisture. The reason why we chose this one is that I have always liked to have a green plant in my office and this one might last longer than the others. Because it is fitted with great soil moisture sensors connected to a PLD !

I am using a Capacitance-type WATERSCOUT SM100 sensor.

  • Range: 0% VWC to saturation
  • Power Requirements: 3 to 5V @ 6 to 10 mA
  • Output: Analog voltage 0.5 – 1.5V for a 3V excitation (ratiometric for other excitation voltages)
  • Resolution: 0.1% VWC
  • Cable Length: 6 ft (1.8 m) and 20 ft (6 m) standard, extendable up to 50 ft (15 m)
  • Accuracy: 3% VWC @ EC < 8 mS/cm
  • Sensing Area: 2.4 in (6 cm) x 0.8 in (2 cm)

It proved to be a very efficient, simple to use and pretty rugged sensor. The only advice that I may share here is related to the “installation” of the sensor. Water the ground, push the sensor down to the black ring and  tamped down to eliminate air gaps. This is critical regarding the reliability of the measurements.

Next is a picture of the oldest version of HL2 PLD (in grey) next to the PLD as proposed  by HL2 through the Kickstarter campaign.

Ultimately, this is a profile from the soil moisture as shown in HL2 Panorama where you can clearly see the decreasing moisture and the watering along the time.

Next post on same subject

PLD (Part 3)

Part 123456

The name PLD stands for “Place and Leave Device”. The original design is big enough to encapsulate its power reserve, the radio module, an arduino ™ microcontroller which will run your own code, and connectors for programming, debugging or plugging sensors. The radio module features the HL2 stack which handles data in terms of optimization of the payload and protection of its content.

Here is an example of use: the PLD drives a DS28b20 temperature sensor that I put in my refrigerator.

Temperature mesurement

From my own experience, leaving the sensor on its own exposed to the “ambiant” air inside the fridge drives to unstable readings. A better practice is to immerse the sensor in a half-liter bottle filled with water. Water will damp the fast temperature changes which translates in smoother temperature profiles. This method is also more realistic as we are interested in monitoring the temperature of the food and goods inside the refrigerator.


The principle of IoT prevents you from uploading a googol of data bytes over the LPWAN networks. On the other hand, you do not want to miss critical events. The in between consists in using a relatively high sapling rate (e.g. one sample per minute) and a relatively slower upload rate (e.g. one upload per hour). This means that the device must be able to compute some statistics which will be chosen for their ability to describe to the user what happened between two uploads. After few experiments, we made our minds and decided to adopt the following statistics: median, quartiles and inter-quartiles. These statistics are much easier to understand than standard deviation and sigmas. The HL2 stack allows the upload of these 5 statistics and the battery level in only one frame thanks to the segmentation function !

Using the H2 PLD, it takes less than hour to configure, program and install a temperature monitoring device where ever you like and get the data from HL2 Panorama from any Internet navigator.

You cannot resist and deadly need a PLD ? Subscribe here

Next post on same subject

PLD (Part 2)

Part 123456

Tadaaa ! This PL…D day

Simple and flexible is here! Check out our new campaign:

Next post on same subject

PLD (Part 1)

Part 123456

Dear arduinoos followers,

You may wonder why the production line of arduinoos went to a stall along the last weeks…

Holidays ? Well it sounds reasonable and logical, however except for a few days of leave here and there (actually in Lyon, Annecy, Saint Martin des Baleines and Val-Andre) during summer time this is not the main reason.

BTW: look at the beauty of mother nature: rainbow over the sea near the Val-Andre

Health ? No trouble, as would say a very good friend of mine “my doctor is fine !” As he does not bother with my own health.

Laziness ? Actually no, definitely no as the world of science and technologies is such a fascinating and exiting one…

So what ? Work ? Yes indeed, and HL2 group, the company that I co-founded 5 years ago, is about to release an amazing product through a Kicktarter program.

Hang on ! I will keep you posted with fresh news very soon …

Next post on same subject