Cool stuff of the day

My daughters played a lot with their “Polly Pocket” in their young ages !

polypocket1

An endless perspective of gaming nicely packed in a hand palm format. Which translates into this portable lab case…

UNO Portable Lab Case

in the the Arduino’s world ! Isn’t it cute ?

More on the Arduino UNO Portable Lab Case >here<

FreeCAD (Part 1)

Part 1

For various reasons, I decided to investigate the field of open source CAD software for designing and printing mechanical parts. So I spent some time surfing the web for CAD applications and found a dozen of software which are topping the hit list. Blender software happens to be trusting the top of this list. A couple of years ago I asked newly hired engineers to spend some time in investing this field and they reported some complexity while approaching this software. So that I decided to give Blender a try my self: ah let’s show these green horns what’s in the old pots :-)

:-( Well, although the software is very nice looking, full of features, the first steps in Blender are uneasy and tedious. Tutorials are helpful but I could not find a “Blender for the rookie”; and top of that, I did not want to spend so much time in learning a new software. In comparison, KiCAD that I use a lot for electronics is piece of cake. Too bad.

Next from the list, described as focused on technical drawings, versatile and able to export all sorts of files (“no .stl, no way”) was FreeCAD. And about 20 hours after running FreeCAD for the first time here are my first impressions, advises, tricks, etc.

freecad_01

20 hours of “spare time” is about the time I needed to feel confortable at drawing all sorts of parts, rectangular and circular, using extrusion and revolutions, sweeping, cutting and fusing, placing axis and components, constraining and exporting. Although it looks like an exhausive description, I have the feeling that I covered one quarter of the features from FreeCad. SO, take the content of this series of post as they are: an other attempt to share experiences.

Getting the software

Simple and easy, there is a dedicated web site >HERE< and a download area >HERE<.

freecad

I personally decided to go for the last stable version, namely “0.15” that I installed on lap top running Windows 7 Pro 64b OS on an Intel Core i7-4500 CPU @ 1.8 GHz with 8 Gb memory. Quite a nice baby.

Learning how to create a sketch, navigate through the screens and memorizing the keywords is essential. The online help is fine but lacks details. You may have to learn the hard way and find answers in the forum >HERE< after multiple desperate attempts to cutting this #$%*§@ part the right way (sounds like real life experience doesn’t it?). There are many, many tutorials, mainly on YouTube which make a lot of sense. I found this series of tutorial mostly helpful for the beginner >HERE< and >HERE<.

Skip the tutorials which do not feature a sound track, most of them are boring and confusing.

freecad_02

This is what you will get on the first run of FreeCAD. In the next posts, I will show and tell a few tricks which proved to be (very) helpful while discovering FreeCAD and yet trying to achieve quite advanced part designs.

Enjoy

Thoughts of the day

I read in the news that the FBI (with a little help from his friends) managed to hack an iPhone which might contain valuable information for tracking some bloody devils. “We no longer need Apple assistance” for breaking the safety locks declared the Department Of Justice. This is the end point of a legal dispute between authorities and Apple. However, I agree with Congressman Darrell Issa (R-Calif.) when he declares that “This lawsuit may be over, but the Constitutional and privacy questions it raised are not”

Few thoughts crossed my mind about this controversy on privacy, like “Hacking is good for your safety” might be the new moto from the FBI, after blaming hacker for breaking safety gates. What is bad today will be good tomorrow, who knows ? But above all is something more general, philosophical and technical. From my early reading on cryptology, deciphering and related techniques, I learned that secrets are all to be broken one day or an other. It is just a matter of time, ressources and often luck (many hints were found in waste baskets…).

Twenty years from now, I worked on a data analysis software which required access to data encoded into binary data files from various instrument makers. Companies like HP were publishing their file formats, some others would agree to help under certain conditions (e.g. after signing a NDA). However, some other ones said “No”, “Never”. I explained that ultimately the file were containing my own data and that I could not understand why I could not get access to them using my preferred tool. “No way”. I took it for a challenge and one week later, after struggling hard, applying all my deciphering science, I broke the file format. And then ? What would I do ? Publish the file format on the web ? Sell it ? Advertise on the poor protection applied to data managed by this company ? This story is all about: never challenge someone who really needs an information as probably all systems can be reverse engineered.

To illustrate this, I will disclose today the password used for decades on HP 9825 computers for unlocking software. The funny thing about this password is that it is a mix of few digits and a (real) dirty word which was far beyond expectations of hackers at the time HP products had this very severe olive green, almost military alike, colors. And this dirty word was …

Credits: iPhone from pcworld.com, HP9825 picture from www.hpmuseum.org

Gamer Assembly 2016

For the second time in two consecutive years, the Gamer Assembly shelters a Makers Space dedicated to the local FabLabs. As a key player in this domain, Quai-Lab displays its current projects: Energyvore a fully original robots game featuring wireless remotely control funny robots which try to collect energy and bring as much of this energy to their home base. Early this morning the team was busy cutting, soldering, printing and coding in order to get ready for this afternoon.

ga2016_1

Visitors could also customize the power pc front panel using simple although powerful commands; they also place many question regarding the tri-copter project. The amazing thing about all these projects is that many different ressources and talents were required from design to electronics, from mechanics to firmware.

ga2016_2

Come and visit us at the GA 2016 !

The bi-bi binary code

Most of us know that many scientists are also artists: Da Vinci was an eminent painter, Samuel F.B. Morse spent much of his life as a painter too, many early anthropologists and naturalists were excellent at sketching and coloring their observations. Nothing too much too surprising anyway, as many scientist share the taste for imagination, innovation, creativity with artists.

And there are artists who are amazing scientists too. I discovered one by pure chance while looking for the lyrics of a song from my young ages.

What would have happened if the war had not crossed Robert Jean-François Joseph Pascal Lapointe’s (mostly known as Boby Lapointe) destiny ?

A fighter jet test pilot as he dreamed about when he was a kid ? Or a computer scientist ? Anyway, the fact is that he invented a binary notation of its own. Which is easy. I will not teach you anything about the three first line. The key for reading binary lies in the cell L4C2. The corresponding sign compares to the trace left by a sliding finger.

bibi_code

Using this notation, we can now state that ” bibi plus koka equal hahoho” ! Hu hu hu, very funny. Funnier and shorter than “One hundred and nineteen plus one hundred and thirty seven equal deux hundred and fifty six”, isn’t it ?

Enjoy !

SG90 servo (Part 1)

Part 1

Many robotic applications feature servo-motors. Most from these servos are used as is, sweeping a +/- 90° angle from an idle position. To the cost of few mods and two SMD resistors, a standard servo can be converted to a continuous rotation mode. I will cover this mod later on.

What makes servos very popular is the easiness of wiring and driving. Each servo features a
ribbon cable with three wires:

  • Black or Brown: Ground
  • Red: Vcc (be careful and check servo specifications)
  • White or Orange: Signal

In this serie of posts, the SG90 will be used as an exemple, the justification of this choice being that it is small, light, cheap and available from many vendors

servo-sg-90

Here are its main specifications:

  • Weight: 9 g
  • Dimension: 22.2 x 11.8 x 31 mm
  • Stall torque: 1.8 daN·cm
  • Operating speed: 0.1 s/60 degree
  • Operating voltage: 5 V typical (3 V to 6 V in some cases)
  • Dead band width: 10 µs
  • Temperature range: 0 ºC – 55 ºC

Although some size specification exist, I encourage you to get the servos in hands before drawing the plans of their mainframe as the dimensions of the servos may vary.

sg-90-drawing

Driving the servo is quite easy. It consists in periodically a positive pulse to the signal pin of the servo. The angle depends on the the pulse width:

  • 1.0 ms pulse width -> – 90 degrees
  • 1.5 ms pulse width -> 0 degree, center position
  • 2.0 ms pulse width -> + 90 degrees

Physically speaking, a servo is made of mechanical, electric and electronic components.

A small DC motor drives a 4 gears train which last wheel is bound to a potentiometer. This potentiometer sends the feed back position signal to the electronic board which compares this feedback signal to the input signal and drives the DC motor according to the difference between the two signals. The heart of the electronic section is the small versatile AA51880 chip from Agamem Microelectronics Inc. > AA51880 datasheet <

The amazing thing about this chip is that it can drive low current DC motor or higher DC motors with 2 or 4 additional transistors (BJT or MOSFET). Next picture illustrates the board as it is fitted to th SG-90 with two 0 Ohm jumper resistors on the footprints which may receive SMD sot-3 transistors on one side and two more plus their biasing resistors on the other side:

P1170417

P1170422

This introduction would not be complete without mentioning that Arduino IDE comes with a standard library which helps in building out of the box applications with servos.

The “Dirty” and the “Clean” codes

No piece of code can claim to have such notoriety. Just a few lines of code buried in a silicon chip beneath a metallic bonnet have the effect of an atomic bomb over the whole planet. Here at arduinoos, we managed to get a copy of these lines of code.

bool a = IsBonnetSwitchOpen();
bool b = IsParkingBreakSwitchClosed();
bool c = IsDriverSeatPresenceSwicthOpen();
bool d = IsDriversDoorSwitchOpen();
if (a & b & c & d) {
	DataLogging(OFF);
	PostInjectionDuration += 10;
	if (RuTime % 1000) {
		CatalystConvertInjection(10);
	}
	DataLogging(ON);
}

Surprisingly, none (as far as I am well informed), none from Volkswagen competitors strongly protested, shouted loud for felony, threatened legal reprisals for disloyal business or what so ever. Why ? Because car makers all belong to a nice family with fair and nice relationships ? I doubt.

me-com-ecu-031

(Image Credits tun-tech.com)

VW is blamed for having knowingly cheated ODB data reported from some of their ECUs, data which are taken into account for the periodical testing of road vehicles. And US hates liars. Beside this fault remains the reality. For how long could be believe that the technology involved in internal combustion engines would follow the desires / recommendations / requirements from the institutions / politicians / legislator ? Do we still believe that athletes can run faster and faster every year and break world records after world records and drink fresh water ? Do we still believe in Stakhanov legend which reports that this pit worker managed to extract 14 times and even 31 times the standard amount of coal from his mine ?

Achieving the ultimate pollution performances without a break up in technology leads to some dirty tricks. And instead of getting back to the legislator VW lied, which is strange because German are generally good at managing quality issues. It is also very likely that their competitors are extremely busy at checking their own files…

At a larger scale but less involving for car makers is this problem with EGR (Exhaust Gas Recirculation) valves. These devices inject a fraction of hot gas from the exhaust pipe into the fresh intake air during engine warm up in order to reduce pollution. Too bad, EGR valves massively fail to work after thousands of kilometers and are quasi-systematically plugged by mechanics.

Also, hackers are familiar with the art of unlocking ECUs and applying mods for boosting the power of road cars or reducing the real millage of used cars which is really nasty. Some claim that open source should apply to cars in order to give any citizen the choice for fuel economy, low pollution or … more horse power. But I fear the computer nerd who will experience a severe bug, right in  front of my nose.

wiringjoke

(Image Credits hpowerlabs.org )

Stay tuned 😉

MicroFAN (Part 3)

Part 1, 2, 3

This part of the subject deals with the code. Nothing exceptional except that it combines multiples libraries: PlainLCD which drives the LCD display, PlainENCi which drives the rotary encoder, PlainTMP for the temperature sensor and PlainEEPROM which handles the erasable memory functions for storing default parameters.

Nota: Using equivalent libraries may not cause major problems for the programmers

There are no major programming complexities in this code, as long as you leave the human interface handling functions untouched. This code is an other example of use of an LCD and a rotary encoder to drive a human interface based on menus. Next are the key components of this specific part of the code:

Declaration of constants:

/* Menu types */
#define MNU_TYP_HEADER 		0x00
#define MNU_TYP_MOD_VALUE 	0x01
#define MNU_TYP_FXD_VALUE 	0x02
#define MNU_TYP_FLD_BACK 	0x03
uint8_t X = 0x00; /* Any value managed by menu driver */
/* Standard captions */
#define CAP_PARAM 		"PARAM."
#define CAP_EXIT 		"EXIT"
#define CAP_RETURN 		"RETURN"
/* Application related captions */
#define CAP_FIRMWARE 	"MicroFAN"
#define CAP_TEMP 		"TEMP."
#define CAP_HIST 		"HISTER."
#define CAP_CTRL 		"CONTROL"
#define CAP_DISPLAY 	"DISPLAY"
#define CAP_STATISTICS 	"STATS"
#define CAP_SETTINGS 	"SET"
#define CAP_MAX_TEMP 	"T MAX"
#define CAP_MIN_TEMP 	"T MIN"
#define CAP_RESET 		"RESET"
#define CAP_FAN 		"FAN"

 

And now the structure corresponding to each line in the architecture of the menu

struct mnuItem { 
	uint8_t menuType; /* One of MNU_TYP_x */
	int16_t minValue; /* min value */
	int16_t maxValue; /* max value */
	uint8_t nextMenuIndex; /* Next menu item */
	uint8_t lastMenuIndex; /* Must be set to 0 as default */
	char *caption;  /* Pointer to menu caption */
};

followed by the architecture of the menu dedicated to MicroFAN:

struct mnuItem vMnuItems[] =	
{ 
/* 	{type, 				min, 		max,		next,	last, 	caption}		*/
	{MNU_TYP_HEADER,	X, 			X, 			X,		X,		CAP_FIRMWARE}, 				
	{MNU_TYP_HEADER,	0, 			3, 			2, 		X,		CAP_PARAM},
	/* Main menu */
	{MNU_TYP_HEADER,	0, 			2, 			6, 		X, 		CAP_SETTINGS},
	{MNU_TYP_HEADER,	0, 			1, 			9,		X, 		CAP_CTRL},
	{MNU_TYP_HEADER,	0, 			3, 			11,		X, 		CAP_STATISTICS},
	{MNU_TYP_FLD_BACK, 	X, 			X, 			0,		X, 		CAP_EXIT},
	/* Settings */
	{MNU_TYP_MOD_VALUE,	MIN_SP,		MAX_SP,		2,		X, 		CAP_TEMP},	
	{MNU_TYP_MOD_VALUE,	MIN_HIST,	MAX_HIST,	2,		X, 		CAP_HIST}, 
	{MNU_TYP_FLD_BACK,	X, 			X, 			1, 		X, 		CAP_RETURN},
	/* Control */
	{MNU_TYP_MOD_VALUE, CTRL_OFF,	CTRL_AUTO, 	3,		X, 		CAP_FAN},
	{MNU_TYP_FLD_BACK,	X, 			X, 			1, 		X, 		CAP_RETURN},	
	/* Statistics */
	{MNU_TYP_FXD_VALUE, MIN_TEMP, 	MAX_TEMP, 	4,		X, 		CAP_MIN_TEMP},
	{MNU_TYP_FXD_VALUE, MIN_TEMP, 	MAX_TEMP, 	4, 		X, 		CAP_MAX_TEMP},
	{MNU_TYP_MOD_VALUE, NO, 		YES, 		4,		X, 		CAP_RESET},
	{MNU_TYP_FLD_BACK,	X, 			X, 			1, 		X, 		CAP_RETURN}	
};

An other critical part of the code is the main loop that I will describe in more details

void loop(void) 
{
	/* Manage user interfce */
	MenuDriver();
	/* Periodical temperature measurement and fan control */
	_now = millis();
	if ((_now - _lastTime) >= _interval) {
		_lastTime = _now;
		/* Run measurement */
		_currentTemperature = (TMP.Temperature() * 10);
		/* Record min and max temperatures */
		if (_currentTemperature < _minTemp) {
			_minTemp = _currentTemperature;
		}
		if (_currentTemperature > _maxTemp) {
			_maxTemp = _currentTemperature;
		}	
		/* Control fan */
		if (_fanControl == CTRL_AUTO) {
			if (_currentTemperature > _tempSetPoint) {
				Fan(CTRL_ON);
			} else if (_currentTemperature < (_tempSetPoint - _hysteresis)) {
				Fan(CTRL_OFF);
			}
		} else {
			Fan(_fanControl);
		}
		LCD.PrintFloat((_currentTemperature / 10.0), 1, 1); 
		LCD.ClearBuffer();
		LCD.InsertString("FAN", 1, LCD_ALI_LEFT);
		LCD.InsertString(vOffOnAuto[_fanState], 5, LCD_ALI_LEFT);
		if (_fanControl != CTRL_AUTO) {
			LCD.InsertString("*", 8, LCD_ALI_LEFT);
		}
		LCD.PrintBuffer(2);
	}
}

On top of the list comes the management of the human interface: as often as possible the code looks for an request from the user. Then comes the management of periodical events, written in a way which prevents millis() rollover problems.

If it is time to run the temperature control, read the sensor temperature and record statistics (min and max, just for fun). Instead of directly applying the temperature to a test box, I added the possibility of forcing the fan. In CTRL_AUTO mode, the fan is ON if the temperature is higher than the set-point and vice versa. However, if the fan is in CTRL_OFF or CTRL_ON mode, it will follow the order whatever the temperature.

Then come a couple of lines for displaying the current temperature and the fan state (a star in the right bottom of the screen means that the fan is in CTRL_AUTO mode).

An other interesting part of the code deals with storage and reading of parameters in EEPROM:

/* Write data */
void WriteDefaultParameters(void)
{
	EEPROM.Address(0);
	EEPROM.WriteInt16(_tempSetPoint);
	EEPROM.WriteInt16(_hysteresis);
	EEPROM.WriteUInt8(_fanControl);
}      

/* Read data */
void ReadDefaultParameters(void)
{
	/* Read data */
	EEPROM.Address(0);
	_tempSetPoint = EEPROM.ReadInt16();
	/* Check data */
	if (_tempSetPoint < MIN_SP) {
		_tempSetPoint = MIN_SP;
	} else if (_tempSetPoint > MAX_SP) {
		_tempSetPoint = MAX_SP;
	}
	_hysteresis = EEPROM.ReadInt16();
	/* Check data */
	if (_hysteresis < MIN_HIST) {
		_hysteresis = MIN_HIST;
	} else if (_hysteresis > MAX_HIST) {
		_hysteresis = MAX_HIST;
	}
	_fanControl = EEPROM.ReadUInt8();
	/* Check data */
	if (_fanControl < CTRL_OFF) {
		_fanControl = CTRL_OFF;
	} else if (_fanControl > CTRL_AUTO) {
		_fanControl = CTRL_AUTO;
	}
}

Again, nothing exceptional, but some new comers may get some ideas on what to do when reading from the EEPROM, as on the first attempt to read from EEPROM, unexpected data may corrupt their code.

If you like the code, you may get it as per my code request policy

Make of the day

Back to the 3D prints again with a spectacular tourbillon !

tourbillon

A must see for all fans of clocks… and 3D prints

And that’s not all, Christoph LAIMER put all the stl files on thingiverse !

 

MicroFAN (Part 2)

Part 1, 2, 3

Let’s talk about some basic electronics. MicroFAN is really easy and requires few affordable electronic components: a 12V fan, Arduino (Uno, Nano, etc.), a 8×2 LCD (a 16×2 LCD will do the job too), a rotary encoder, typically a 30 pulse 15 detents per round (so as to say 1 cycle per detent) will be great, a N-Channel MOSFET: an IRF540 or equivalent will definitely be overrated but it’s OK because you  obviously have one in your scrap box and it will allow you to drive a  dozen of fans like a charm. Plus some extra components.

 

g2522

Connecting the LCD is almost trivial. You may skip the potentiometer and wire VEE to ground. Wiring the rotary encoder is trivial. The fan driver consists in a hot spot (Vin, or +12V in our case) connected to the positive pole of the fan. The negative pole is switched (or not) by the MOSFET transistor. Although the 1K resistor in serial with the transistor gate is not mandatory, it may prevent cries in case of wiring errors. The power may come from any wall plug adapter feeding MicroFAN with a stable +12V under a few hundred milliamps (250 or more will be just fine for driving one fan).

For your records, here is the pin-out for the TMP04 temperature sensor:

tmp04

What else ?

The best is probably to use an Arduino proto-shield to hard-wire components. I use this principle a lot so that I can swap arduino boards from one application to an other without having to rewire the required components. I suggest that you choose the bare board which is cheap compared to the assembled one (x4 more expensive):

caa0b3efac4b6ffb7e70a85e5c0ed350.image.538x354

and a 36 male pins header (2.54 mm) like this:

header

that you can get for less than 1€ each in quantities.

Next post on same subject