Artificial Neural Network (ANN) Example for Emgu

May be it will be helpful for some one or not – but anyway here is an example of ANN-Artificial Neural Network for Emgu

There are some disadvantages of Emgu ANN implementation. One of them is missing an information about reaching train criteria TermCriteria. Another one is that in this Emgu version not possible (or I do not know how) to get correct trained ANN without correcting  <min_val> <max_val> <min_val1> and <max_val1> in configuration file. Any way ignoring that you can modify it only when you save ANN data to file, then loading this file and modifying those min/max values (need to enter correct values):

configContent = configContent.Replace(“<min_val>0.”, “<min_val>0”);
configContent = configContent.Replace(“<max_val>0.”, “<max_val>1”);
configContent = configContent.Replace(“<min_val1>0.”, “<min_val1>0”);
configContent = configContent.Replace(“<max_val1>0.”, “<max_val1>1”);

then Emgu ANN implemented quite fine and it is powerful tool for image recognition.

Read the rest of this entry »

No Comments

Using FT232H Synchronous mode in Matlab

if ~libisloaded(‘ftd2xx64’)
%libfunctionsview(‘ftd2xx64’); % to view addition information about driver
handlevalue = int32(0);
handle = libpointer(‘voidPtr’, 255);
calllib(‘ftd2xx64’, ‘FT_Open’, 0, handle);
calllib(‘ftd2xx64’, ‘FT_ResetDevice’, handle);
calllib(‘ftd2xx64’, ‘FT_SetBitMode’, handle, uint8(255), uint8(0));
calllib(‘ftd2xx64’, ‘FT_SetBitMode’, handle, uint8(255), uint8(64)); %if status, error(errorlist{status}); end;
calllib(‘ftd2xx64’, ‘FT_SetLatencyTimer’, handle, uint8(16));
calllib(‘ftd2xx64’, ‘FT_SetUSBParameters’, handle, uint64(65536), uint64(65536)); %if status, error(errorlist{status}); end;
calllib(‘ftd2xx64’, ‘FT_SetFlowControl’, handle, uint16(256), uint8(0), uint8(0)); %FT_FLOW_RTS_CTS
calllib(‘ftd2xx64’, ‘FT_Purge’, handle, uint64(1));% if status, error(errorlist{status}); end;
Read the rest of this entry »

No Comments

WifiBroadcast WN722 and power boost!

I have tried to implement Wifi Broadcast described in Thanks for nice work!

To measure latency green LED, impulse generator and oscilloscope was used. Experiment result showed that average latency is around 120 ms. Minimum latency is 95 ms maximum 180 ms. Minimum latency appears quite seldom once per several seconds, but I never saw latency around 80 ms or less.

Using Raspivid without broadcasting, just displaying over HDMI on this same Raspberry Pi 40 ms latency was observed. So on Raspberry Pi USB we get around 10 ms latency and if we have wifi broadcast system where are two USB (one on receive, other on transmit) we get extra 20 ms latency. Data from camera we get 30 fps that 33 ms then H264 decoding+ encoding – all in total 120 ms.

In my quad I used WN722 dongle but it has maximum 20 dBm amplifier. According WN722 specification its receiver has different sensitivity to data rates. In my experiment I used 3Mbps to 6 Mbps data rates, thus maximum range was around 60-40 meters. Note that 20 dBm is around 100 mW. Large data rates spread this power to wide spectra and reduces data receive distance. WN722N card has 6M: -88dBm@10% PER sensitivity plus 4 dBi its antenna. Reception range for this configuration should be over 1 km, but because energy is spread to wide channel 22Mhz (Wifi channel size) then range is significant lower than 1 km. Thus to increase range 33 dBm amplifier (ALM-32220-BLKG) with 13 dB gain was used. Experiment showed that range increased from 40 to 230-250 meters with these same 4dBi antennas. In Fig. 1 is shown an example of assembled amplifier on quad. Case of quad is used to cool down amplifier, because it uses 0.6A current at 5V. Also it has its own 1A 5V DC-DC converter.


Fig. 1 2W 2.4GHz amplifier for WN722N, left home made PCB. Right assembled on bottom of quad.

Read the rest of this entry »

1 Comment

Raspberry PI2 Low Video latency vs Analog FPV

Digital FPV systems are always compared with its analogs fast versions. So there was an interest to measure digital FPV based on Raspberry and compare it with some analog FPV. For comparison we used Arkbird 1/3 Sony 960H CCD 700TVL FPV Camera and  DAL TX600 FPV 5.8G 600mW 32CH AV Transmitter and as receiver Dominator HD googles with build in 5.8 Ghz Receiver Fig. 1.


 Fig. 1 Analog Camera (NTSC) and 600mW transmitter

Our analog FPV latency measurement diagram is quite simple. We measure blinking light source in front of camera and photo-diode response at the LCD display Fig. 2.

schem1Fig 2. Measurement diagram of Analog FPV

As light source we used simple 5 mm LED driving with 1V and 1 Hz frequency. As measurement device we used DET210 – High Speed Si Photo Detector, 350MHz BW, 200 to 1100nm because we have it on the desk Fig. 3. Photo diode was attached to DominatorHD one of Fresnel lens to catch LED green light from LCD screen.



Fig. 3. An example of used tools to measure analog FPV latency

Read the rest of this entry »


0.2 mm 3D print PLA vs ABS

Recently I switched to 0.2 mm nozzle from 0.35 and here is result of experiment. Printing speed 50 mm/s, material white PLA and natural ABS, layer height 0.15 mm.


Fig. 1. Left Image – part printed with PLA, Right – natural ABS

Experiments were made with different speeds (20..150 mm/s). Main problem was with PLA plastic. It seems that to thin filament drops quite fast when extruded from nozzle and forms arcs (Fig. 2). Read the rest of this entry »

No Comments

CP2102 USBxpress with Embarcadero C++Builder

I tried to use CP2102 device and USBxpress driver which is available on SiliconLabs site. Driver you can find in USBXpress Development Kit. My system is Windows 7 64 bit and programming environment is Embarcadero® C++Builder® XE3 (Note that it is 32 bit C++). It seems that correct way to use SiUSBXp.lib is to convert with program implib.exe:

implib -f SiUSBXp.lib c:\SiLabs\MCU\USBXpress_SDK\Library\Host\Windows\x86\SiUSBXp.dll

I have installed USBxpress SDK in c:\SiLabs\MCU, thus there is 32 bit library file SiUSBXp.dll.  The program implib is origin of RAD Studio and can be found here c:\Program Files (x86)\Embarcadero\RAD Studio\10.0\bin\.

Note: run command line environment using Administrator privileges. In this same path where implib.exe is placed, the fileSiUSBXp.lib will be generated.  It’s size around 3.5K – almost twice less than original file. To run USBxpress library files with RAD studio project, you need three files SiUSBXp.dll, SiUSBXp.lib and SiUSBXp.h (download files of v4.0 version). Copy two files into your new created C++ Project directory, also copy SiUSBXp.dll file to Debug or Release directory. If not – you will get such error:


Read the rest of this entry »

1 Comment

Connecting Micron MT47H64M8-25E to Cyclone III

Recently I was forced to connect CIII (EP3C40F484C6) to Micron MT47H64M8-25E DDR2 🙂 I choose variant when DDR is connected to a single bank (in my case Bank 3). As reference voltage 0.9V I use LDO TPS71709DSE. Note that for reference voltage need sink and source. To fix this problem I used resistor of 49,9 ohm (Fig.1), it sinks some extra power and stabilizes LDO voltage to 0.9V without this resistor reference voltage will be near 1.6V because of BANK3 REF inputs pull voltage up. Note that for BANK3 and DDR need common power supply of 1.8V to meet STTL18 Class-I requirement for data and address buses.


   Fig.1 Schematic of DDR2 and CIII Bank3 connections

Read the rest of this entry »

No Comments

DMPSGC54A Polygon Mirror Scanner Motor pinout

Recently I tried to make simple laser scanner device with laser printer Polygon Mirror scanner DMPSGC54A. I was unable to find electrical pin-out of this unit: 



Read the rest of this entry »

1 Comment

uClinux/Linux for NIOS

There is a web page where you can find nice description about running Linux or uClinux on NIOS processor but for me-not experienced Linux user it was paint-full to run Linux fast as I want. So, I will try to show my steps in two branches successful and not successful.

At the beginning I was confused about differences between uClinux and Linux for NIOS as you see later they seems to be using the same uClinux-dist directory to make image. For experiment I used Terasic DE0 development board it has 8-Mbyte SDRAM quite enough. Operating system is CentOs-6  and gcc version 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC) (try command in terminal: gcc -v) and Quartus 11 (without SP1).

At first place you may need to install Quartus (I used Subscription Edition) and NIOS II Embedded Design Suite (this one I used for test purposes). Personally I am using Virtual Box installed in to Windows XP, thus you may nod need to install Quartus on Linux, but I suppose it is worth to forget Windows and stay in Linux.

Read the rest of this entry »