Friday, May 3, 2024

Use nozzle diameter larger than 1mm in Ultimaker slicer

If you are like me have an FDM printer (mine is Creality CR6-SE) and want to use nozzle of sizes larger than 1mm (the maximum nozzle diameter defined in this printer profile), then this tutorial will help you. 

In the software toolbar, go to  "Settings", "Printer", and select your current printer


Click "Manage printers..."

Click "Machine settings"


Copy all settings of "Printer" and "Extruder 1" to external files (take a screenshot of both settings, and copy start and end G-codes to a text file). We will need them later



Close "Machine settings" window

Close "Preferences" window

In software toolbar, go to "Settings", "Printer", then click on "Add printer..."


In "Add printer" window, select "Non Ultimaker printer"


Collapse "Add a network printer" bar



In the "Add non-network printer" section, collapse the "Ultimaker B.V." group


Expand the "Custom" printer group


Rename your printer, then click "Add"


Copy all settings from your old printer (from the external files) to the new printer in "Printer" and "Extruder 1" tabs



In "Extruder 1" tab, you can apply any "Nozzle size" you want

Later on, for any print, you have to manually edit nozzle size in printer settings. The drop down list of nozzle size in Cura will not be any more visible for this custom printer

As you can see in below example, I change nozzle diameter to "1.5mm" and hence the line width is "1.5mm" as well









Wednesday, July 25, 2018

Digital tools for benchmarking and market research


If you are going to lunch a product or a service, the following tools may help you better understand the technical and financial requirements of your target customers. These tools are the best used for home products and appliances.

[1] Competitors website:
Visit competitors websites, see what products or services they offer, what are the variants of these products, see pictures and videos, download user manuals, ... etc. 

[2] Google trends:

Google trends is a very powerful tool for understanding the target customers. Using Google trends you can get trends by time, region, and much more. The following can be done but not limited to:
- Know which cities/states/countries are more interested in certain products or services.
- Which intervals of the year a certain product is in high demand.
- How product or service demand growed during the last years.
- What are the keywords the customers search for more.
- Which language the customer prefer to search for a certain product or service. 
- Compare trends of multiple search items.

As a worked example, the chart and map below show a comparison between search trends for both Jumia and Souq during 2018 in Egypt. Definitely, we can get out the following information:
- Both Jumia and Souq had high traffic in November because of Black Friday campaigns
- Souq has always higher interest than Jumia the whole year
- It seems that Jumia had started the Black Friday campaign a couple of days earlier than Souq.





[3] Google play store:

For products that are linked to smart phone applications, you can get figures about number of downloads and user reviews from the play store.



[4] YouTube channels:
You can get better figures about your expected customers by reviewing number of subscriptions of relevant channels.


[5] YouTube commercials:
Check commercials of competitors on YouTube, see what are the features or services they offer, what are the features they emphasize on, .... etc

[6] YouTube reviews videos:
On YouTube, there are a  lot of reviewers who review products technically, tell the advantages and disadvantages of the product in more sensible way.

YouTube comments:
Navigate through video comments, check the feedback of people, classify them to promoters and ditractors.



[7] Search on Amazon: 
Search on Amazon for related products, check what are the available products, see their pictures, get average prices, and study and collect specifications.

[8] Amazon reviews:
Amazon reviews are trusted and pretty useful, but make sure not to give any false impressions based on few comments.

[9] Search on Facebook:
Search on Facebook with different keywords about the product, see pictures uploaded by users, and see what people say about it. Facebook is not searchable by Google, so try not to ignore Facebook search.

[10] Facebook page likes:
Check number of likes and followers of competitors Facebook pages.

[11] Facebook advertising:
You can use Facebook advertising filters to know the audience size of certain product or service very accurately based:
- Gender
- Geographic location
- Age
- Status keywords
- Liked pages
- Activity duration

[12] Facebook comments and emoticons:
Analyze customers response, read comments of people, get their impressions, check out their hash tags.

[13] OLX:
By using OLX you can understand the following:
- How much customers are looking for your product or service
- How much a certain product or service is sold
- Reselling of used products and the reasons behind reselling
- The relationship between customer class and product category
- The customer behavior of using products by analyzing picture data and advertisement details
- Product life span
- Product deterioration by analyzing the visual status of the product.


[14] Air bnb:
The same as OLX, using Air bnb can give better understanding for how a portion of your customers are using your products by analyzing pictures data.



Tuesday, July 24, 2018

DOE: Resolution III Plackett-Burman design

In Design of Experiments DOE, Plackett-Burman design is one of the screening designs which is used to detect the most significant factors out of large number of factors. The idea behind this design is to make number of level combinations of any two factors is the same through the whole design. To achieve this criteria, massive iterations are required; for this reason statisticians decided to calculate this design offline and save it instead of calculating it each time. 

Plackett-Burman design is based on 2-level factors and has a resolution of III. 


To construct Plackett-Burman design we first calculate number of runs. Number of runs is a multiplier of 4: e.g. 4,8,12,16,.... where number of runs should be larger than number of factors. For example, 9 factors will require 12-runs Plackett-Burman design. Simply, number of runs of this design can be calculated by the simple following equation:


Number of runs=ceiling((Number of factors+1)/4)*4


Since the treatments of this design are pre-calculated, there are two ways to get these treatments. In this article we will go through an example of 12-runs Plackett-Burman design.


The first method is to use what is called the "generating vector". The generating vector is a pre-calculated vector of all levels of the first factor (factor A) except for the last level. For example, the generating vector of 12-runs design will has the length of 11. In this method, treatments will be created by writing all levels of each factor column one by one.


To create treatments, we start with the first factor and assign the following vector to its levels:

++-+++---+-


Where "+" denotes the high level and "-" denotes the low level. Reading this vector from left to right represent factor levels from top to bottom in the design matrix.

After that, each vector of each factor will be derived from the previous vector. For example, vector B will be derived from vector A, vector C will be derived from vector B and so on. Simply, the last element of vector A will be the first element of vector B. This is better imagined by assuming that the generating vector forms a closed circle and each factor vector will start with the last value of the previous vector. The following image can explain how this may look like.




At the end, after generating all vectors, the last level of each factor will be set to low level "-". Or in other words, the last treatment in the table will be with all factors set at low level.

The following .GIF animation shows how the generation of each vector is derived from the previous vector.




Alternatively, the second method, some books prefer to give the entire table of factor levels for all treatments. Programming wise, the single generating vector has the advantage of small memory consumption and the disadvantage of extra processing time. The following table shows all treatments for 11 factors. It is very noticeable how diagonal the matrix looks like because of shifting explained before.





References:


https://www.itl.nist.gov/div898/handbook/pri/section3/pri335.htm

https://en.wikipedia.org/wiki/Plackett%E2%80%93Burman_design


Key words:

Plackett-Burman design

Minitab Plackett-Burman design

Plackett-Burman design matrix

Plackett-Burman design pattern

Plackett-Burman design table

Plackett-Burman design algorithm


Plackett-Burman design step by step

Sunday, July 22, 2018

How automatic water feeder works

Few days ago, I was thinking how the automatic water feeder (dispenser) of pets and birds works. I searched over the internet and the answers seemed to be very traditional "air has to replace the water going out"!!!!.

The automatic water feeder is a simple mechanical device that is intended to continuously and automatically feed water for pets and birds without the need to refill it frequently. The innovation in this device that water feeding is done without flooding or over flow.

Simply, the automatic water feeder consists mainly of two elements: tank and sump. Referring to the schematic below, the tank has two properly sized holes at two different heights (extremely small holes will not allow air flow or water flow because of surface tension force).  The bottom hole is the water feeding (bleeding) hole and the top one is the air hole. The ratio between the volume of the tank and the volume of the sump decides how frequent the user has to refill the tank. The top hole level also decides the maximum water level in the sump. The lower hole level decides the wasted water volume inside the tank that can not be fed to the sump.



The same concept also exist in the domestic cold and hot water dispenser.

The tank used in most common automatic water feeder for birds is a lid which is filled with water, the sump is placed over it, and then the whole setup is flipped vertically to start working.

So, how this automatic water feeder works?

To answer this question I will explain this on the general physical model of this automatic water feeder as shown in the image above.

After filling the tank and flipping it over, air pressure inside the tank is atmospheric pressure. Water pressure at top and bottom holes is higher than the atmospheric pressure outside, so water flows from both holes but with higher rate from the lower hole (assuming that both holes have the same diameter). As a result, air vacuum increases inside the tank.

Modelling water as a rigid body, there will be a force acting on it because of pressure difference between its sides: a vacuum pressure from one side and atmospheric pressure from the other side. Outside air will push water surface (at hole 1)  inside till the applied force can overcome the surface tension of water, penetrate water, trapped in, and then move up because of buoyancy force until it joins the trapped air at the top of the tank resulting in decreasing the vacuum effect.

This surface tension describes why air is getting inside in an intermittent way in a form of large bubbles. As a result, water will flow out and so on. This will repeat over and over until water level is above the top hole center where a tiny area of the hole is not covered with water. At this instant, air pressure can not exert the enough force on this very tiny area to overcome surface tension and penetrate water and air and water flow will stop.

When outside water level is just covering the top hole, and although the top layer of the outside water still has atmospheric pressure, air can not get inside the tank because air pressure is applied on the whole water surface and water is an incompressible fluid. 

By consuming outside water by pets or birds or due to evaporation, and as long as the water level inside the tank is going down, the flow rate of water from the bottom hole is getting slower because the pressure difference across its sides is reduced.

In this post I tried to proof why water stops at the level of the top hole using mathematical method by studying different general water levels in the sump and assuming a static steady state where the water level is static and this -as a result- means that there is no water flow through both holes. By concept, water will not flow through hole when the pressures on its sides are the same (ignoring pressure drop across the hole). In this model, vapor pressure of water will be ignored.

First case: Outside water level below the bottom hole:
By applying the following equations and solving them simultaneously it has two physical solutions:


[A] Top and bottom holes are coincident (one hole). This is not our case because we have two holes.
[B] Impossible to happen if there are two holes at different levels.










Second case: Outside water level above the bottom hole:

By applying the following equations and solving them simultaneously it has two physical solutions:

[C] Water is at the level of the top hole.
[D] Impossible to happen





based on solutions [B] and [C], water will flow as long as it is below the top hole and it will stop flowing only when the water level reaches the top hole.

Third case: Outside water level above the top hole:

This case will only happen when extra water is added by the user above the top hole level. By applying the following equations and solving them it has only one physical solution:

[E] It is possible for all water levels above the top hole level as long as the water level is lower than the tip of the sump.




Fourth case: Inside water level below the top hole:

In this case water levels inside and outside will be same.



This theory of operation is only valid for relatively short tanks which are used in domestic and household applications and is impossible to apply for any tank with water level higher than approximately 10 meters (assuming zero absolute pressure above water inside the tank).


References and useful links:



Tags and keywords:

How bird automatic water feeder works

How bird automatic water works

How bird water dispenser works

How pet automatic water feeder works


How pet automatic water works

How pet water dispenser works

Automatic water feeder theory of operation

Automatic water feeder working principle

Tank two holes fluid dynamics

How self filling water bowl works

Monday, July 16, 2018

Mixed level factorial design algorithm

Assume you have a set of factors let's say [A,B,C] and each factor may be assigned different values (let's call these values "levels"). For the purpose of testing (using general full factorial design) you want to try all combinations of all factor levels with each other knowing that each factor may have number of levels different from the other factor. The following table will be used as an example:


Theoretically, to solve this problem, nested "For" loops will be needed where number of loops equals number of factors. This may be impractical to implement specially when number of factors is not constant.

The proposed algorithm simply mimics the mechanical analog counter (or more specifically Tally counter) like the one shown in the picture below but with a slight difference in implementation. In analog counter, the rightmost digit wheel is the driving wheel and when it increases above 9 it will reset back to 0 and the next digit one the left will increment by one. The same rule applies for all other digits: when the digit value increases above 9 it resets to 0 and increment the next digit on the left side by one.  

Reference: https://www.shutterstock.com/video/clip-4902245-analog-mechanical-counter-numbers-that-turned-quickly

In mechanical analog counter, all digits have an upper value of 9 and lower value of 0. On the other side, in this algorithm, each digit will have its own upper value which equals the number of levels while the lower value will be 1.

Let's assume that factor A will be represented by the digit wheel on the leftmost side and factor C will be on the rightmost side so that factor C will be the driving wheel.

By knowing the number of levels of each factor we can calculate the total number of combinations N by multiplying all factor levels (N=3*2*4=24 in this example).

Now, we will increment factor C for N times and after each increment we will do a check for all factors (digits), if any factor exceed its upper bound, it will reset to 1 and increment the next digit on the left side by one.

The counting process of the previous example will look like the simple animation shown below:



This algorithm is very efficient and -theoretically- has no limitation on number of factors or number of levels.

The following VBA code can be used to implement the previous algorithm

Sub CreateTreatments()

Const NoOfFactors = 3

Dim MaxLevels(NoOfFactors) As Integer
Dim FactorLevels(NoOfFactors) As Integer
Dim Letters(NoOfFactors) As String


' Define factor letters
Letters(0) = " A"
Letters(1) = " B"
Letters(2) = " C"

' Define number of levels of each factor
MaxLevels(0) = 3
MaxLevels(1) = 2
MaxLevels(2) = 4

' Reset all factors to the minimum level
FactorLevels(0) = 1
FactorLevels(1) = 1
FactorLevels(2) = 1

' Calculate number of runs (combinations)
NoOfRuns = 1
For i = 0 To NoOfFactors - 1
NoOfRuns = NoOfRuns * MaxLevels(i)
Next i

For i = 1 To NoOfRuns

' Create combination text
CombinationString = ""
For j = NoOfFactors To 1 Step -1
CombinationString = Letters(j - 1) + CStr(FactorLevels(j - 1)) + CombinationString
Next j

FactorLevels(NoOfFactors - 1) = FactorLevels(NoOfFactors - 1) + 1    'Increment rightmost digit

For j = NoOfFactors To 2 Step -1    'For all digits
'If factor level is higher than number of levels, then reset it and increment the left digit
If FactorLevels(j - 1) > MaxLevels(j - 1) Then
FactorLevels(j - 1) = 1
FactorLevels(j - 2) = FactorLevels(j - 2) + 1
End If
Next j

Debug.Print CombinationString

Next i

End Sub


This code will output the following lines in debug window:

A1 B1 C1
A1 B1 C2
A1 B1 C3
A1 B1 C4
A1 B2 C1
A1 B2 C2
A1 B2 C3
A1 B2 C4
A2 B1 C1
A2 B1 C2
A2 B1 C3
A2 B1 C4
A2 B2 C1
A2 B2 C2
A2 B2 C3
A2 B2 C4
A3 B1 C1
A3 B1 C2
A3 B1 C3
A3 B1 C4
A3 B2 C1
A3 B2 C2
A3 B2 C3
A3 B2 C4


Keywords:

Mixed level factorial design algorithm

Tuesday, June 26, 2018

Excel VBA create combinations

If you have a set of elements let's say {A,B,C,D,E} that you want to create all possible non-repeating combinations for, then here you are two simple and straight forward methods. In some cases you may need to know the all possible combinations rather than counting or calculating their count like in the Design of Experiments DOE.

Unfortunately, in this post I am not going to share a copy-and-paste code, but I will introduce two algorithms to implement them easily using any programming language in any suitable way.

As an example, there are 31 possible combinations for the previous set which is hard to calculate manually and the problem can be more serious with higher number of elements.

In both methods we will use letter-coded elements and will rely on some string processing functions. For example, if you have five billiard balls with five different colors, the following coding may be applied:



Method 1:

In this method we will create (initialize) an empty two-dimensional string matrix having number of rows (M) equals the number of elements (n) and number of columns (N) equals the maximum number of combinations for a given group size. Let's name this matrix "Combinations". This matrix will contain -when it is completely filled- all possible combinations for the given set of elements. Each row of this matrix will contain the combinations of (i) number of elements where (i) is the row number of "Combinations". The main advantage of this matrix structure is to contain data in a compact form instead of having long one-dimensional array. This structure also makes it easy to calculate the combinations manually on paper or in spreadsheet.

For the example shown above, the "Combinations" matrix will look like the following image:




The method pseudo code looks like the following sequence:

Define the elements {"A","B","C","D","E"}

First of all, add all elements to the first row of "Combinations" matrix

For each row (i) of "Combinations" matrix starting from first row to the row before the last row

Set column_counter=0

For each non-empty combination in column (j) in the current row (i) of "Combinations" matrix

For each element in elements

If the element is not contained in the current combination string then

If the element alphabetical order is higher than the alphabetical order of the last element in the combination string (ASCII code of element is larger than the ASCII code of the last element in the combination) then

Create new combination by string concatenation = current combination + element 

Increment column_counter by one 

Add this combination to the first empty cell in the next row of "Combinations" where row number equals i+1 and column number equals column_counter

End If

End If

Next Element

Next Combination

Next Row of "Combinations"


The evolution of "Combinations" matrix during the solution process looks like the following animated .GIF file (frame each 5 seconds)




Method 2:

This method is definitely more simple than the previous method. The core principle of this method is making a good use of binary number representation that it is made of zeros and ones 00101. Each bit in this binary format will represent the existence of the element in this combination; zero (0) means not-exist while one (1) means exist.

To apply this method, we create one-dimensional array for the elements of size (n), one-dimensional array for the binary number representation of size (n) as well, and one dimensional array of size (2^n)-1 for the generated combinations.

The method will go in the following workflow:

For each decimal number starting from 1 to (2^n)-1

Convert the decimal number to n-bit binary format

Multiply each element letter by the corresponding bit value in the binary array and join the results. Note that this is a symbolic multiplication which will return a string where  A * 1 = "A" and A * 0 ="".

The resulting string is a possible combination which will be added to the combinations array.

Next decimal number

Since this method produces combinations in a non-sorted way, alphabetical sorting for combinations may be required for better display of data.

To better understand the method, the following is an animated .GIF file (frame each 5 seconds) which shows how the method works.




Key words:

Unique non-repeating combinations algorithm

Combinations using binary number representation

Combinations programming

Combinations pseudo code C++ and VBA

Efficient combinations algorithm

Compute combinations

How to compute combinations

Excel VBA combinations of cells

Combinations matrix


Monday, May 14, 2018

PCB design tips and tricks

Electronic circuit design:

[1] Draw well-formatted schematics

[2] Define operating conditions, moisture condensation, and water ingress

Board geometry:

[1] Define PCB shape, dimensions, and weight.

[2] Make holes for PCB mounting

[3] Make cuts or slots for easy PCB pullout from its assembly

[4] If wires are going to be soldered directly on PCB, the make a setup for strain relief like clamps or zip ties

[5] Make sure that the PCB has only one possibility to mount in the device by making slots or non-symmetric guides.

[6] Use PCB cut for isolation between high and low voltage

[7] Make holes under IC sockets, to eject ICs easily from the back

[8] Design for penalization (multiple PCBs in one shot)

Layers:

[1] Start your design with single layer PCB first. If one layer is not enough, then move to two layers and so on.

[2] If you are going to control high power loads, then you may use PCB with thicker copper layer (2 oz/ft2 instead of 1 oz/ft2)


Components location:

[1] Design to use electronic components that are available in your local market

[2] You may use some THT components as SMD

[3] Divide your design into modules and locate inputs and outputs of each module

[4] Sort modules based on the connections

[5] Put power components on one layer and control components on the other layer

[6] Define the orientation at which the PCB will operate to place hot components at the top.

[7] Place service components always accessible as possible like: memory cards, SIM cards,  batteries, fuses, varistors, potentiometers, ... etc

[8] Place components as near as possible to other related components

[9] ِAlign or array components of the same type and package

[10] Put spare components in the PCB (such as a spare fuse)

[11] Use sockets for components expected to be replaced or upgraded, or if you afraid of overheating IC chips during soldering

[12] Make your design smarter, so it can be used to produce different variants by just adding or removing few components

[13] Place micro-controller in the middle of the PCB.

[14] Make status LEDs that till you that the PCB is alive

[15] Consider ICSP pins to reprogram your micro-controller in the future

[16] If your PCB has no user-interface, then make an external debugging interface

[17] Consider using external removable jumpers to enable or disable a function

[18] Save areas for TO22 package layed flat

[19] Consider heat sinks orientation

[20] Use PCB copper area as heat sink for heat-dissipating components

[21] Use one large screw terminal block instead of multiple small blocks if they are going to be placed beside each other because it is difficult to align them 

[22] Place components in locations where it is easy to de-solder. For example, don't place and SMD component trapped between high components from all directions.

Tracks:

[1] Check the manufacturing capabilities of the PCB manufacturer you are going to deal with first. If you plan to etch this PCB manually, then use large tracks and large track spacing.

[2] For power tracks, calculate track width so that the voltage drop is accepted and track temperature is maintained constant at given ambient conditions and cooling method

[3] Use through hole components to jump over tracks if you have limited number of layers

[4] If you have limited number of layers, use wire jumpers

[5] Keep enough area empty of tracks around holes so screw head or hexagonal spacer will not affect them

[6] Avoid putting pads in the way of a track

[7] Use decoupling capacitors just beside the IC

[8] Avoid using stubs

[9] Use low impedance tracks for high frequency lines by making shorter paths and wider tracks

[10] Reduce number of bends in the track as possible

[11] Use shorter paths

[12] Use very short paths for power lines used as relays to get compact PCB

[13] Use short spikes between components and large tracks

[14] Don't use right angle path

[15] Don't use acute angle paths

[16] Maintain the parallelism and equi-spacing of data lines

[17] Keep enough clearance between tracks

[18] Avoid using loopy tracks (antenna)

[19] Use ground plane to connect all ground pins and avoid the hassle of connecting them

[20] Use ground plane carefully. If you are going to control high power loads and use ground plane, make sure that there is enough area for current to flow

[21] Get rid of thin islands

[22] If ground plane is used, keep areas under high voltage components void (clear of copper) to avoid dielectric failure.

[23] Keep areas under transformers empty of tracks

[24] Avoid passing tracks under components or IC chips as possible for easy track tracing and repair in the future

[25] Use star connection for 5V instead of daisy chain

[26] Use parallel tracks for sensors to cancel noise

[27] Avoid passing tracks between pads

Labeling:


[1] Use unique labels for all components

[2] Label component code if there is enough space

[3] Use component code if it only has no alternatives or it is not allowed to be replaced with another component

[4] As possible, put labels beside components, not under them

[5] Try to avoid placing labels on tracks

[6] Create labels in ascending way from the top-left corner to the bottom-right corner so that they can be reached easily by eye sweeping

[7] Label soldering pads to test connectivity

[8] Create label for revision number and production date

[9] Create label for contact details: company name, website address, phone number, or email

[10] Create label for disposal method



Pads:

[1] Consider test pads. Test pads are flat blind pads where they are expected to be used for testing and troubleshooting purposes.

[2] Consider golden fingers

[3] Consider connector pads. Connector pads are this pads that can be cut to permanently enable or disable a function

[4] Keep enough distance between soldering pad and track

[5] Snap all pins to perforated weaver board, so you can prototype easily

[6] Make sure that no pins will touch component in the back.

[7] Avoid over-sizing of through holes

[8] Use thin pads as fuses

[9] via under SMD IC chip to save space
Prototyping:

[1] Print your PCB to paper and place components on it to check matching of the footprint

[2] Try your circuit on bread board

[3] Visualize your design in 3D

[4] Get rough figure for the price of the PCB




Additional references:

https://en.wikipedia.org/wiki/Printed_circuit_board

http://www.robotroom.com/PCB-Layout-Tips.html