Σάββατο, 10 Δεκεμβρίου 2016

AUTOPILOT MEGA (APM) - Now, we 're getting serious

Well beyond ardupilot I (best known as ardupilot legacy) , the excellent APM 2.5 (or 2.x) hardware and corresponding firmware gives the opportunity to fully explore the potential of modern mems devices and other electronic modules. In particular , using modern ultra fast and cheap GPS modules from China such as Ublox NEO 8M we can develop UAV's with astonishing position hold and track follow accuracy.

My new (gen II) auto piloted car is based on a simple wireless remote controlled jeep given as a NiCd battery discharging device with a SKILL portable drill. I changed the motor driver with a quick-and-dirty perf board with an ATtiny2313 and a L293D to control steering and traction motors.

ATtiny 2313 and L293D dual channel PWM motor driver

Then I (over) loaded the little toy with an APM 2.6 autopilot, a 5V power module,a Ublox GPS, 915MHZ telemetry module, 2.4Ghz R/C receiver, servo camera (or antenna, machine gun, whatever) gimbal, 5.8 GHz video transmitter and a 3c 2200mAh LiPo battery. It finally looks like this :

APM inside

Without camera or 5.8 GHZ video transmitter 

This particular rover is a fine platform for developing and testing autopilot modes, ground control stations (GCS), PID controller behavior, GPS accuracy, R/C remote - telemetry - video range , power consumption and electronic interference between modules. Its maximum speed is 0.4m/sec but with an 2200mAh LiPo battery it can travel for hours with everything on, and you can’t lose or crash it. You can hardly wear its "tires" too.

Let's see it in action at night with an automatic mission with 4 waypoints. Using the Ublox 8M GPS (16 satellites HDOP 1.35m) we get the following astonishing results regarding the track repetition accuracy of a such an economic combination of hardware and firmware !!! (even multipath issues are not affecting GPS performance -what else can someone ask ?)

Night testing of GPS - autopilot accurancy

On Michael Oborne's excellent Mission Planner GCS we can clearly see the telemetry data and 5+ track repetition accuracy.

  Ublox 8M GPS impecable performance  

 Ublox 6M GPS has a decent performance as well 

This little thingy has travelled literally lots of kilometers without any issues. Just charge the battery and go on. You can 't imagine the joy you get when seeing this little fellow driving on after one and a half hour, hitting one waypoint after the other with more than 60% of battery remaining !!!. 

Πέμπτη, 21 Μαρτίου 2013


A trivial application of ultra cheap Chinese ultra-sonic modules like the US-020, is to use it as range finders. The question is what is the maximum distance we can measure. These modules have an on board microprocessor and so we don't have any access on front end receiving amplifiers or transducer driver stages. The signals we get are pre-processed. A search through the available cryptic manuals on the net depicts a polar diagram that shows max distance about 10' (~300cm) which is far less than the 400-500cm advertised on ebay.
We wanted our setup to be portable in order to have some outdoors measurements. So we connected our arduino mini to a linvor slave bluetooth module and used our mobile android phone as a terminal using an excellent free android application named Bluetooth SPP by Jerry Lee.  Bluetooth  SPP  realises the SPP bluetooth service on an android device and is rock solid, much more robust than standard microsoft SPP service on ms Win XP BT stack. Plus, it includes a file logger !!  At first we measured a distance of approx  5 metes and we certified it with a laser rangefinder. Accuracy is pretty good (within 1 cm )  for such a low priced device and consistency is impeccable as you can see in the following video.

Searching for the maximum distance in a noisy outdoors environment was quite difficult. We used an office chair to be able to rotate the measurement setup on  the horizontal plane. At last we could get 1009 cm as  the maximum reading in our terminal while 1135 cm seems to be our maximum software limt. Accuracy was in the range of 5cm and consistency was not bad at all using a simple software filter that rejected erratic measurements. 

Πέμπτη, 3 Ιανουαρίου 2013


  Maximum HVAC efficiency is obtained with the use of inverter airconditioning units that have a  CEP  3.5 or more.
  The idea is to control some (3 or more) sets of split type airconditioner units with a central (master)  unit.  This  master unit runs a time schedule by reading the onboard RTC, logs data and slave responces to a micro SD card,  communicates with the slave units via RF24L01+ modules at 2.4GHZ and even takes care of local room temperature by reading a precision centigrade temperature sensor LM35Z and controlling   the local airconditioner unit with an IR led that emulates the original (Hitachi's) infrared remote control. And last , but not least, an input from a power meter (like an Electric Owl CM160 ) monitors electric power consumed by all air conditioner units to prevent power overload.  
  Slave units comunicate with master via  RF24L01+ modules,  read temperature with a LM35's as well , and send infrared commands to the remote airconditioner units. In case of RF link failure they can even take over  local control.
     All units are based on Arduinos's MCU's. Behind the idea of centralised HVAC control is, of course the optimisation of mains power consumption. Below is a photo of a master unit  prototype. On the prototype shield on top of an Arduino duemillenove, you can see the RF24L01+ module, the RTC module (a DS1307) with the backup battery, the infrared led and 2N2222 driver. The temperature sensor LM35Z is behind the RTC module adjacent to the analog pins of the shield. Sd card is an optional add-on . On the paper are my so-far failed attempts to decode the manchester-encoded pulses of the electric Owl's  CM-160 receiver output. On the oscilloscope you can see the infrared pulses that control the shutter of a Pentax X-5 camera which plays the role of the receiving airconditioner unit just to make sure that no interrupt handling inside RF24,RTC,SD,SPI  or WIRE libraries interferes with the time sensitive infrared carrier signal of 38.4KHZ Two buttons are also  provided to send commands like "emergency Power OFF all units" or "set all units to SLEEP 1H  mode".  

Master unit prototype
Code on the master unit takes approximately 26K of flash memory and on the slave a mere 14K.(Atmega328). We can also provide all units with PIR detectors to sense human presence and to inform master to take care accordingly. Every unit can also be connected via USB to a pc for debugging purposes.  

Σάββατο, 6 Οκτωβρίου 2012


Here is a servo adapter for non-infrared remote controlled cameras. Upper servo controls shutter and lower zoom functions. Servo position can be adjusted to fit multiple camera makes. The video shows adapter controlled by the arduino universal remote camera controller which controls the camera array of my previous post.

This adapter can be controller by a pc via an rf (xbee) link or arduino's serial usb port , the mini remote control shown here, the hacked helicopter remote control of the previous post, any  PWM R/C remote or by using time lapse and PIR / infrared barrier ports /buttons  on board  arduino pcb

Τρίτη, 18 Σεπτεμβρίου 2012


I really like remote controlled cameras. Unfortunatelly, affordable ones are very rare these days (like Pentax Optio S1) . An infrared remote control was considered standard accessory during the good old days of  mini-dv and other  tape camcorders but now one has to try hard to find the little red-purple  piece of plastic at the front face of contemporary video equipment.
So,I  decided to make an arduino infrared remote controlled camera array . An arduino prototype board with an infrared led and two servos controls at least four different pieces of video equipment and has a few  options useful for nature and wild life photography as well.  A motorized camera rig is on the way.
Oblique view of the  camera array

Rear view of the camera array
Camera array in action

Arduino sends infrared remote codes to the cameras in order to control functions like shutter press/release, zoom in /out, snapshot recording and video recording toggle. Arduino infrared is controlled remotely by either by a  PWM R/C remote control , a serial  digital link (or Xbee) ,  a 433MHZ 4-Channel  button remote control or locally using butons on the arduino board itself. Even two servos can be connected on the board to control shutter and zoom in manual-only cameras. A relay output and an user configurable input can be connected to a PIR detector or an infrared barrier.
A "hacked" 433MHZ radio link -we just get TTL Rx/Tx signals and 5V to feed  Arduino

Arduino infrared prototype feeded by a  7.4V  LiPo (5400mah!!) , a 3A/ 5V swiching regulator, and a hacked 433Mhz serial link . Bottom center is the Infrared led and one of the two optional servos for shutter and zoom functions.  

The not-so-innocent cheap helicopter model remote control and hacked  433Mhz serial receiver. Everything inside original remote  was discarded and a 433Mhz serial link (the same as the receiver) was added  together with an arduino mini at 16 Mhz, another  two axis left joystick and two extra buttons below it.  Power comes from  4 NimH batteries and a 5V/3A switching regulator,  Line-of-view range is about 300 meters.  

Arduino infrared prototype is controlled by an -also hacked - 4-channel 433 Mhz garage door  receiver. The minimalistic remote shown on the right has a line-of-view range of 300 meters ! It can control shutter , Video recording and Zoom functions of every camera in  the array.   

 2 channels of a common  PWM R/C receiver are connected to the arduino prototype. We can control  shutter , Video recording and Zoom functions of every camera in  the array also,  using flap  (CH6) switch for shutter and Video record toggle, and  throttle (or elevator) joystick (CH3/CH1) for Zooming functions.     

Another useful option is the built-in intervalometer   which takes time-lapse videos like this one :

You can see a FHD of the above video if you click on the following  link :
or this one :

Δευτέρα, 26 Σεπτεμβρίου 2011


These fine nights of September when Orion rises early the morning above the horizon, and Jupiter dominates the sky, its a pleasure to use the small ETX-70 telescope guided by its Autostar 494 controller. That telescope costed a mere 200 Euros at Lidl and in my opinion it isn't just a fine little telescope for the beginer, but it's also  perfect for land surveing. When Lidl sold its Bresser microscope (another 60 Euros welll spend), it supplied it with a USB camera that fits not only to the microscope , but via an (supplied) adapter to the 1.25'  eyepiece holder of the ETX-70. Even though the USB video adapter has a resolution of just  640 x 480 pixel , it is very good for land surveying as  shown on the following  video. At this case the distance to the subject (the Mi-8 Helicopter) was about 2.5 kilometers, temperature was about 27 deg. C, a sea area existed between the scope and the target and atmospheric conditions far from perfect. Barlows 3x lens was also used that deteriorated the resolution but I wanted to push it to its limits.


From the point of view of an electronics engineer the most interesting feature of the ETX-90  , is the precise guiding mechanism which can be controled by the computer's serial port. All you need is the optional 506 cable set from Meade which is actually an RS232 to I2C adapter that connects to the AUX port of the microscope. A lot of info is written about Meade's serial protocol but the best way to learn about it (exactly as I did) is to tap the serial cable and spy on the data when controlling the telescope with a proper software such as Drsoft 's Meade control panel , Carte des Ciels or Stellarium. A much more elegant solution to taping the cable is to duplicate the controling serial port using a serial to ip server, and open a teminal (like TeraTerm) at 9600N81 to view and log the traffic.After all my finds were :

#:Mn#  Slew north (up)
#:Ms#  Slew south (down)
#:Me#  Slew east  (left)
#:Mw#  Slew west  (right)

#:Mw##:Mn#  Slew right up    (NW)
#:Mw##:Ms#  Slew right down  (SW)
#:Me##:Mn#   Slew left  up    (NE)
#:Me##:Ms#   Slew left down   (SE)

#:Qn##:Qs##:Qe##:Qw# Stop movement after above commands
#:Q# Stop movement for all motors

#:Sw2#   Slew speed slow
#:Sw3#   Slew speed medium
#:Sw4#   Slew speed fast

FOCUS  CONTROL - there isn't any focuser on the scope - we will talk about it later.
#:F+#    Focus +
#:F-#   Focus -
#:FQ#   Focus Stop
#:FF#   Fast Focus
#:FS#   Slow Focus
After reading the excellent info on http://www.weasner.com   I learn that : " when typing a single control-F on the terminal  the Autostar should echo an "A" or "P" depending upon whether it's
 set up as Alt/Az or Polar mount status and when typing #:GVF#  it should respond with its identification string, including the word Autostar and a time and date (when that firmware version
 was built at Meade) ".
Indeed  :
 Ctrl -F    ---> A
#:GVF#   ---> #Autostar|A|12Ea #    

Σάββατο, 10 Σεπτεμβρίου 2011


       Using micro-controllers one can easily (!!!) make an intelligent rechargeable battery monitor in order to check if his NiMh or Nicads are in good condition. Let's take my favorite Arduino for example. It has 6 analog ports, so we can take a six battery holder, cut all inter-cell connections (they are connected in series), put a resistor in series with each cell (it we are keeping it simple - a current source would be much better) and measure and log the voltage as it drops through the resistor. We could also program some kind of Processing script to display the results graphically on the computer.
       Well, I used a different - and  faster approach. I used my intelligent 10-cell charger and my Sony TRV-22 DVR in photo mode and its simple intervalometer. TRV-22 can take photographs every 1, 5 or 10 minutes in memory stick (120 photos 640x480 resolution on 8MB memory stick)  I fully charged the batteries and then discharged them , photographing the charger's leds every 10 minutes. When a cell is being discharged a red led flashes slowly  and when discharging is over it lights steadily until full charge when it  finally becomes green. The fist discharged battery is the weakest and the last one has the maximum amount of energy. In the following time- lapse video you can see that batteries 8 and 9 are the first to begin charging (that means that are the first to discharge - the ones with the less energy) because their leds lite steadily first of all the others. Battery number 3 is the best because its charging begun 2h 45' after no's 8 and 9 (by examining the EXIF metadata in every pictures file).
      Night vision is enabled on TRV-22 because most of the process took place at night. Here is a video of the discharging sequence :  

The above procedure can also be accomplished with a web cam and a capture program with intervalometer function. There are a few free ones on the web. Timing error if 10 minute interval is used is +/- 10min. Following time lapse video shows charging sequence :