Sunday, December 28, 2014

Wireless TV transmitter / receiver - teardown and repair

I've recently bought a broken wireless video RX/TX pair off of eBay. The audio was being received properly but there was no video.

Since the system works at 5GHz there is no way to easily figure out if it's transmitter or receiver at fault.




In the end I managed to get it working and took some pictures in the process.

EZCast M2 teardown

The microUSB plug on my newly acquired EZCast / Miracast dongle came loose so, obviously, I had to take it appart.

The system is based around a single chip: AM8251 - a single-core ARM9 system-on-chip built specifically for this purpose.
There's an XDA thread on units similar to this:
http://forum.xda-developers.com/showthread.php?t=2632288
and on one of the manufacturers' forums:
http://forum.iezvu.com/bbs-en/viewtopic.php?f=2&t=802

The big chip on the other side is a Samsung NAND flash chip, probably this one (K9F1G08U0E).
I don't know what the smaller IC is, but I assume it's the WiFi stack chip.

Small review:

It does the job fine especially at 720p. Ironically (or not) AirPlay mirroring has less lag and dropouts than Android mirroring. Tested with iPad Air, Galaxy S5 and Motorola Razr.

Other users are complaining about a lot of dropouts but I'm not experiencing that. I'm sharing the WiFi through a FritzBox 7390, so perhaps the quality of the router also matters.

Unfortunately it cannot fully replace the existing ChromeCast dongle I have so I'm forced to use both: ChromeCast for YouTube videos and EZCast for everything else.

Desktop mirroring is decent, I can stream Amazon Prime ('Instant Video') movies and they are watchable at 720p. At 1080p the framerate is too low. Tested with a Core i7 laptop running Win8.1 through a 300Mbps wireless connection on 5 GHz.





Central ventilation augmentation

My apartment building has a central ventilation system built-in. While it does a pretty good job at getting the kitchen smells out it also makes a lot of noise and wastes heat when closed.

Out of the many possible solutions I decided on building a cover that goes on top and is activated by the red LED that lights up when the original ventilation system is turned on. This means no messing around with mains - galvanic isolation.

After the break, the story of going from this:


to this:

Along the way there will be some interesting tidbits - original design, capacitive light sensing, low-power techniques and code.

Thursday, November 27, 2014

Developing for Windows Phone - a story


Around three years ago I bought one of the first models of WP7 phones to appear - HTC Mozart 7 - which was very similar to the Android-based Nexus One. Wanted to see what's like to be an early adopter and early player in the app marketplace.

I managed to get a free app registered on the app store: Fast Offline Translator EN-DE.
http://www.windowsphone.com/en-us/store/app/fast-translator/ccf24cce-d48e-e011-986b-78e7d1fa76f8
I did it mostly for myself as I knew very little German. Not much has changed since.



This is the story of doing the development, deployment and update for that app.


Wednesday, November 26, 2014

Adventures in video blogging

I started preparing for doing short YouTube videos - lighting, cameras, display setup, sound. In this post I will deal with the software editing setup and a bit of hardware.

Editing requirements:
- synchronize videos from multiple cameras - DSLR, point & shoot, camcorder, mobile phones, capture
- single video in a split-screen setup showing multiple streams
- must be able to zoom in on a camera
- subtitles and image overlays
- speed boring portions of the video up
- switch between microphones, adjust levels and compression

The baseline video: http://youtu.be/KTEGRSdxxxg - what I expect to get out of the programs.

Windows Movie Maker

Everyone's favorite:  unfortunately it's not multi-track and awkward to use. Most of the free / really cheap editing suites fall in this category.

Adobe Premiere

Too expensive, but the last time I used it (several years ago) was pretty ok.

Kdenlive

Really good, supports most of the stuff above. Unfortunately it's Linux only so I was running it inside a VM. Interface is pretty good, spent around 2-5 hours for the learning phase and another 2 for the editing.
Rendering took really long, around 3-4 hours.
Speeding up sections of the track proved to be a bit challenging.
I haven't spent time figuring out how to edit the audio.
Requires twiddling with a few parameters (preview quality, caching)

Blender

Hailed as the next big thing coming from the OSS movement it has everything including the kitchen sink. Which is also where the problem is.
With no training you'll likely end up with 100 windows open. That is, if you can get past the cube and you remember to match all your video frame rates (it can be worked around though).
After 2 hours of struggling with it with no manual I went to study about 10 hours of YouTube tutorials. Spent another 2-3 hours editing but it still felt really wrong.
There is no support for even basic sound editing - like stretching the video and sound together to match a duration.
Requires a lot of tweaking and twiddling (preview, input format, output format, windows).
Rendering time was around 2 hours for 1h40m, so pretty quick, but the resulting video had a few artifacts.

Sony Vegas / Movie Studio

I used a Vegas trial but I expect Movie Studio (which retails for ~30 EUR) to behave the same way.
It was really quick to get into, makes the right decisions for you. Spent less than one hour researching how to do what I wanted to do and around 2 hours for the total editing time.
The editing time also included identifying and speeding up portions of the video, adding captions and other minor tweaks that I did not do in the other programs. So, overall, I was twice as productive.

There were several other programs that I've used but dumped them quickly because they were either too restricted or too difficult to use. I used these list for a selection, looking for the ones which were updated lately and had some lifetime: http://en.wikipedia.org/wiki/Comparison_of_video_editing_software and http://en.wikipedia.org/wiki/List_of_video_editing_software

While I continue to support open source my time is more valuable to me, especially if I'm going to do this multiple times.

Hardware

The video linked above is more than one year old and was not shot with the gear below

Nikon D7000
Hacked firmware to record more than 20 minutes. Using an Android phone or tablet with USB OTG cable and DSLRDashboard for setting up and checking the result.
Canon SX230HS
Connected via mini-HDMI to a display, has optical stabilization and pretty good macro capabilities.
Generic video-out camera
These are used for reversing systems for example. Can be set up outside, for timelapse videos or just for checking what's happening behind me. Connected to a small car TV screen.
Lapel microphones
I have two of these but haven't decided which one to use. The will connect to the DSLR.
2x 160W CCFL studio lights
They stand on height adjustable tripods which can also take umbrellas: diffusers or reflectors.
3m x 6m green-screen
The green screen is mounted on an adjustable stand - 3m length, up to 2.4m tall - and can be replaced with other fabrics, like white or black cloth.

There's still the issue of high background noise (hopefully the mics will solve that) and addressing an invisible audience in a non-native language. So perhaps it's better to practice the speech beforehand or dubbing over.
It's also best practice to set manual white balance and exposure compensation and have a neutral-colored table surface.

Monday, May 5, 2014

Quick update - txtr Beagle, Toshiba TV firmware and queued projects

There are several projects in which people seemed interested that have a pending follow-up:

Txtr Begle alternate software

I have managed to buy another one off eBay since one month or so.
I've tried setting up the Python bluetooth suite but it's not working on Windows and there are no ready-made binaries. I do not want to force people on Windows to hunt around.
I've tried setting up a Java program to communicate via Bluetooth SPP to the Beagle. However this proved extremely unreliable and highly dependent on your Bluetooth suite and hardware adapter.

The best solution for now seems to go the txtr way: make a phone app. I will try to develop an Android app that is able to: send screenshots to the reader, send pre-rendered browser pages and perhaps pre-rendered pdf documents. It will probably take one afternoon of research and another afternoon of coding, source code will be made available upon completion.

Toshiba TV firmware

One week ago I have finally received the CD with the source code which Toshiba graciously provided. There's not much on it, certainly less than expected, I wanted to be able to be able to compile my own firmware but it only seems to include the (modified?) source code for the GPL libraries.
I will have to take a deeper look and check the uBoot modified code, that would be the key to decrypting the firmware and at least be able to compile and pack individual items.

The good news is that there is a full Webkit installation so it should be really easy to redirect the TV to a page of your choice - think router/NAS with DLNA/XBMC remote page.
The Webkit package is ironically called HbbTv.

Fail of the week projects

I have two projects that are likely candidates for the Hackaday fail section but require a good write-up if a lot of people are going to see them.

One of them is a dual power supply that I made, also described a bit in some earlier posts. It works and does the job, but barely, and I'll explain why and how it should be done. Basically a lot of DON'Ts.

The second failed (or barely working) project is a diploma project that I helped a friend with, one year ago. I was too late to the party to have useful input and instead spent days debugging hardware instead of writing the firmware. Another one full of DON'Ts.

Queued projects

The Node@Home sensor network. Quite a few projects have started implementing some of the stuff I want (like OTA firmware updates, a-la OptiBoot) but nothing hits the mark. I will also have a chance to put my newly-found Javascript skills to use.

Sony Liveview / Remote bluetooth display. This is meant to provide navigation directions when riding a bike or motorcycle. I've reached the stage where I can do a lot of the stuff with the Liveview and was considering choosing a different platform.
Unfortunately there is no API for accessing the directions from Google Maps (Android) and I've tried playing around with the Sygic one (the navigation of my choice) but their API does not seem to work. However I'm able to get directions using the accessibility API which does the purpose, if text only.
I will put the code on GitHub within a month and will also do some power/authonomy measurements on the LiveView.

Triple power supply. Basically a rehash of my current PSU implementation but with a proper PCB, current limiting and rotary encoders. At least 3 voltage outputs.

Arbitrary waveform generator. The proof-of-concept is already implemented with a Stellarpad and a 5$ ADxxxx module, but I need to add a display, case and rotary encoder to it. And perhaps an output buffer. That's 90% of the work remaining.

McHck. I've watched the community on and off and they project seems to have slowed down quite a bit. I have the parts on hand, I wanted to take a stab at designing my own PCB but I'll probably choose the smart way and order 5-10 of PCBs.
I'm just not sure I want to invest time in a project that does not seem to take off, community support is so underrated these days. I'm also worried they deliberately chose against an Arduino-like implementation and rolled their own library. They can still do it, but I think this really killed a lot of the momentum.

Boxes of things

I have already taken apart and documented >100 [dead] devices bought off eBay, with more than 30% of them repaired or repurposed. I just don't know how to group or sort them plus adding images and doing layouts via Blogger is a pain. But some of the more interesting stories will manage to get here.
I still have around 50 devices that still need checking and taking apart.

Building a cheap USB power measurement device + analysing some USB chargers

In this post I will describe a way to build a really cheap device that will allow you to measure USB power consumption and supply characteristics. It's ugly but it takes 15 minutes of your time and a broken USB hub.


Then I will take a look at various USB chargers and see how they perform, hopefully not as bad as the one depicted below:

Tuesday, April 22, 2014

Free embedded programming course on edX

I've enrolled into the UT.6.01x Embedded Systems - Shape the World somewhere back in January/February but never got around to finishing all the exams, yet. It's a microcontroller development class focused on ARM architecture, using TI Stellaris LaunchPad as the platform.

https://courses.edx.org/courses/UTAustinX/UT.6.01x/

It's been a mixed experience so far, let me explain why.

The good:
- using a widely available board, cheap, out-of-the-box. The class can theoretically be completed even without any hardware
- well-structured curricula with a relaxed and modern teaching style
- free! (unless you want the certificate)
- it touches on a lot of real-world topics, every theoretical experience is backed by practical examples
- goes through all the major peripherals without too much detail
- automatic grading system that's awesome in theory

The bad:
- the presentation is discontinuous, videos are interspersed with text, sometimes in a new chapter, sometimes in the same chapter. Makes it hard to follow and have for example an evening of watching videos and an evening of reading text.
- you are forced to use Keil as an IDE. I'm used to either Eclipse or the notepad-like Arduino IDE. It gets in the way with non-standard shortcuts, bugs and trial popups
- the grading plugin is limited, forcing you to use one implementation of the many possible ones. When you don't get it "right" it will fail with little explanation ("PCTL_R not properly set")
- even in the later labs there is still no provided library that can set up the ports for you, you have to do everything manually, all 15-20 registers
- the online quizzes have a result entry box that while accepts formulas it's really slow in parsing them (5~10 seconds on my i7)

It's at the same time fun, useful stuff, but very frustrating to use. I can't imagine designing a complete state machine (there's one exam where you design a traffic light) in Keil, I'll probably have to invest some time to redefine the shortcuts but more likely I'll have to do a proof-of-concept design in C that just uses stdio and compiles in a shell and then translate that into uC code.

The grading plugin takes some time getting used to:
- you have to make sure the project options (target, library, compiler) are properly set each time otherwise you will not understand what's going on
- the site generates a "public key" number that you paste into the grading window, after the evaluation the plugin generates a "private key" that you paste back into the web site
- if you paste a wrong key in the website the public code gets reset to a random value
- if you reset the simulator/board/cpu, the key entered into the plugin gets reset
- the grading plugin is not aware of state, you have to reset the board before grading to make sure it is running correctly
- combine the above three and you will probably spend at least 5-10 minutes to get your grade into the system because you copied the wrong code or you restarted the program
- you have to manually press the buttons or whatever you have on your board, which kind of makes sense, but it's annoying

I read the curricula in ~3 hours, on and off, the videos have captions so kudos to them.
A quiz takes me about 2-12 minutes to finish, since I already know most of the stuff, even without reading the courseware. There are 14 quizzes in total.
A lab takes me about 10-20 minutes to fully implement, including the hardware, then maybe another hour to debug why I'm not getting 100%. I've finished 8 labs out of the total 11, but the remaining three will take more time than the previous ones.

All-in-all the course could take around 10 hours to complete if you were free to choose the IDE and libraries of your choice. Probably 30 hours because of the quirks.
Just to mention, I haven't used the forums nor other channels of communication with the class, so all these issues had to be solved with no help. That's good practice, I guess.

My suggestion for a similar class would be:
- design a bootloader for the system that outputs data via some port (serial, usb over serial, gpio, etc)
- design a program that interfaces with said port and collects the data necessary for grading. It also resets the CPU prior to making a test run
- the program can be a browser plugin or it can have its own HTTP client to connect to the main grading system
- if the above is not possible (proxy issues for example), do not reset the "public key" each time a check is unsuccessful. Instead, keep it there for 5 tries and WARN the user when the key changes
With the changes above the student is free to use Energia/Arduino, Eclipse or whatever IDE/compiler combination he desires. If he knows how to properly set the PLL, pull-ups and ADC then he's anyway golden.

Useful non-spoiler notes:
- You cannot set interrupts on PORTA, PORTB, PORTE because the TexOS library uses those.
- for the interrupt lab I had to reset the board when it said to toggle the switch back, I could not get it to recognize the (positive-logic) switch change otherwise
- for the UART lab you do not require to add the " or ' characters to the string. I wish this information was visible somewhere
- I might write a library or a cheat-sheet that will be useful reference for future students, that should make it easy to set up the GPIO. It will be an Energia/Arduino pins.h port.

It's been a worthwhile experience so far, even though it reinforced my debugging skills rather than my embedded programming skills. Probably that's a more useful skill anyway.

Edit:
Would be worth to mention that perhaps it would have been a good idea to introduce students to unit testing. Basically having mock services/peripherals that can simulate real ones, in order to verify that the algorithms work. So the students would write a file that compiles to an executable that's easily run on any OS.
This should be a staple in embedded development and I'm saddened it's not taught more but rather by trial&error. Unit testing and test-driven-development are good things that should be inherited from higher level languages.

Also, I might have judged Keil too harshly: it is the best embedded simulator environment hands-down. You can run code and see variables in near-realtime, probe analog and digital channels, inject your own data and add plugins (like the grading one).

Sunday, March 30, 2014

Scosche myTrek - teardown and repair

Got this pulse monitor from eBay, advertised as broken. When paired with a phone it always showed 100 bpm. Searching a bit on the Internet saw that quite a few people had this problem as well ("stuck at 100 bpm").

The front has three buttons, the middle one being pairing/on/off and the left and right ones supposedly change the tracks on your phone media player. Controls seem very similar to the bulk of bluetooth headphones.
The backside has the sensor in the upper part - I suspect the pulse-oximeter type one - and two round pads for the charger dock.



It's clear now why the bracelet does not give any readings:

Due to bad engineering there is no proper strain relief for the wires between the sensor and the controller.
I'm inserting a link break here since this post a lot of pictures.

Inside stuff - teardown and repair of a Spy Pen

This came out of a "box of things" that I regularly purchase on eBay. They consist of new items that are DOA (dead on arrival).

It's a "Spy Pen" or "Spy Stick" - a USB stick with a 4GB capacity that also has a camera inside.

The second line under the title makes absolutely no sense, it's like someone used OCR + Google Translate:


The end cap was unglued, also the stick would not take a charge. With a bit of force the motherboard slides out, revealing a camera module that's literally plugged in:


Great, I get a 4GB microSD for free:
Also notice the reset button, I have no idea what's that for, I assume pressing it while plugging the stick in will allow uploading new firmware. Also, the battery is held in position with sticky tape.
The other big chip is a 25Q80SCP, 8Mbit flash, probably holding the camcorder firmware.

A clearer picture of the battery side with the camera connector. I don't know what this chip is but I assume it's an integrated solution for cheap camcorders: Anyka AK1120Q06402:

The battery was dead so I tried removing the kapton tape and access the third terminal. This allowed me to bypass the protection circuit and charge the small battery.
When charging an unknown LiPo the safest maximum setting is 1C - in this case 160mAh. Just be aware of the fact that many manufacturers fake the printout, putting you at risk of overdriving the small LiPo and causing it to explode. Your best bet is to find a similar-sized battery that is original and use that capacity as guideline





With the battery off the camera can still be used, it draws around 50mA which would make it perfect for a flight cam or other small embedded project:

The "innovative" packing method is used to put the pen back together:

Hopefully I will remember to put some samples from the camera here, the quality is not so bad as I would have expected. It's certainly better than most camera phones pre-smartphone-era.

Spektrum DX6i - backlight and timer hack

This post is just to make people aware of a project that I did a while back.
I was annoyed that the Spektrum DX6i remote that I had did not provide the useful timer features of the DX8i. That is, the countdown timer should be automatically activated when the throttle is actuated instead of requiring the user to manually pull on the trainer switch.

Hardware and firmware side together this hack took me around one hour to complete so it should take you much less should you consider to perform it.

I've spent another hour retrofitting the display backlight and adding that functionality to the firmware as well.

Features:
- one PIC10F222 (<1$ in single units)
- can detect whether single-pitch (plane mode) or collective pitch is used
- starts timer on throttle up, stops it when throttle is removed
- backlight is activated when the menu wheel is moved, deactivated after 5s
- inactivity warning: after 90s of no usage the remote beeps at you
- features can be disabled at startup by powering up the remote with the throttle in the high position


Pictures and details after the break:

Friday, January 17, 2014

Windows 8.1 preview to final in-place upgrade

I had to install Windows 8.1 Preview over the Windows 8 installation which was giving me problems. The problems went away but yesterday I got a nice surprise:


This preview version has expired. Please upgrade to Windows 8.1 using the Store. The computer will reboot in two hours and then every hour.


...or something along the lines.


I started downloading the update but then read on some forums that the installation will wipe clean your previous programs and probably settings, only the [useless] apps will remain in place.


Here's how to skip the trouble and perform an in-place installation of Windows 8.1 while retaining all your previous programs and settings. You will need to have a valid Windows 8 product key.


Steps summary:
1. Go to the 'order page with product key only'
2. Download Windows 8 installer
3. Start the installer and cancel after it reaches 1%
4. Download Windows 8.1 installer from the same link
5. Launch the [new] installer and let it download the image
6. Make an installable USB drive
7. Edit USB:\sources\cversion.ini and replace 9458.0 with 9431.0
7. Create USB:\sources\ei.cfg with the content below
8. Launch USB:\setup.exe and perform the in-place upgrade
9. Restore your Windows 8 key / serial number


Explanations:
[TODO, doing these steps myself just now, will add links]


ei.cfg content:
[EditionID]
Professional
[Channel]
Retail
[VL]
0



cversion.ini content:
[HostBuild]
MinClient=9431.0
MinServer=9431.0



The installer also requested me to manually uninstall the following programs:
  • Sentinel Runtime Drivers - caused by Lightworks. Download haspdinst.exe and run it with the parameters "-fr -kp"
  • N-Trig installer - this is from my drawing tablet. Renaming \Program Files\N-trig to N-trig.old solved this
You need to install Windows 8.1 without a product key because the Windows 8 key will not be accepted.


To restore your key launch cmd.exe in Administrator mode and enter:
slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
slmgr /rearm


Obviously you need to replace the 'X's with your valid key.

Tuesday, January 14, 2014

DSO5062B - "white screen" repair and hack

I have a lot of posts in my backlog that have pictures but no text added to them. Since a lot of them are more than one year old I figured I should take the effort to add the text lest I forget what happened.

There is a common problem with the DSO5062B oscilloscopes in that they get a white screen once in a while and require a power cycle to recover, temporarily. The scope seems to be functioning in the mean time but nothing is displayed.
The same device is being sold under many different name and brandings: Tekway DST1062B, Voltcraft DSO5062B, Zhongce, Protek, PCE (like mine) but it's exactly the same thing save for the splash screen and printed logo.

Here's how the white screen syndrome looks like, see below for the fix:


Medion MD97900 laptop teardown and repair

I've bought a cheap broken laptop on eBay for around 20EUR with the description "turns on briefly the fan and the shuts down, no image".
The laptop was actually in pretty good condition, came with a working battery and charger and RAM, but without any hard-drive.

A quick search on the Internet turned up the fact that these laptops usually die from heat, having inadequate cooling on the integrated video card.

I recovered the laptop by using a makeshift heat shield made from a sandwich of aluminium foil and cardboard an using a heatgun (paint stripper) to slowly heat the chip. A blob of leaded solder was used as reflow indicator, knowing that the leadfree solder melts at higher temperatures and the BGA balls take a while to heat up (being under the chip).
A cheap multimeter was used as a temperature indicator, with the thermocouple pressed against the chip body.
The cardboard started smoking after a while but this did not affect the operation in any way. The actual heating process took around 2 minutes, another 30-40 seconds were used to slowly pull the heat gun away from the board and it was left for ambient cooling another 10-15 minutes.

I won't bore you with stories, I think the pictures below tell all the details.

Node@Home communication protocol draft

I have been pondering on creating a home network of nodes using cheap slaves and a more powerful master. Since the name did not come up in any Google search I settled upon Node@Home.

My idea is to have gadgets spread around the house/perimeter that can report sensor data to a central station and perform certain actions. It will be first used to start the [electrical] heating remotely, check rooms temperature, actuate the blinds on the outside, log the voltage measured by the home-made PSU, start or unblock the Roomba, etc.

I am sure that with creating an affordable master node (based on Stellaris Launchpad or Raspberry Pi) and disposable slave nodes will make everyone want to have these things around the house.

The minimum requirements for the nodes will be a baseline microcontroller (PIC10/12F, MSP430F, <1$ each) and an NRF24L01 radio transceiver (1-4$). The power of the network will be in the protocol requirements and the software.

UPDATE: the draft below is wrong because I assumed broadcasting was possible with the NRF24 units, which is not. I have written a new one in the mean time but I did not have time to implement a proof-of-concept, so I'm not publishing it until it is proven.
However, the payload section will remain mostly as-is.

Here is my first draft for this, loosely based on the BMW IBUS protocol: