Monday, January 25, 2016

Adding touch screen to Siglent sds1022c oscilloscope

The goal

Remove keyboard completely, instead add touch screen to control oscilloscope.

Usability

Big, mostly for ease of use (in my case), besides I always wanted to have DSO with touchscreen.

Parts

  • arduino nano (atmega328p)
  • some cable
  • touch screen panel from Prestigo 7" tablet

Code


Hardware

  • Siglent SDS1022C oscilloscope
  • 7" touch screen frame (I get it from Prestigo PMP3270B tablet)

Media

Touch screen with test buttons and gestures.


Description


If you're reading this post, you should also check this one Oscilloscope fix by upgrading display from 5.6 to 7.0 inch , this is a continuation.

After my post hit hackaday.com, some of you wrote that the housing is freaking ugly ;) In my opinion was not so bad, below is a picture to remind you how it was looking like.

Old SDS1022C housing. Yes this is black electrical tape.

The worst was the keyboard, which was sticking out from the housing outline. I had no way to change this, because the display data cable was too short and it only fit like above.

So I thought I could get rid of it.

Keyboard protocol


First idea was a simple one. On the back of DSO there is a COM port, which normally is used to communicate with your PC and software like EasyScope etc. Unfortunately, when I flash it with different software (from 7" version), COM stopped working (just like USB). So I needed to abandon this idea, and search a different way to do it.

After some time I've decided to rip off the black tape, and once again dive inside my DSO. I've checked all connections between motherboard and keyboard, finally I found three signals that was looking like clock, data and some kind of reset. It was funny, because I was analyzing DSO keyboard protocol with the same DSO. This was a pain in the ass too, because when I pressed a button, Blackfin CPU start to process keyboard request and display was freezing, exactly for the period needed to clearly see what's happening.

Finally after couple of weeks, when I check it one more time, I managed to emulate keyboard data with atmega32, then I just mapped all the codes that was used to control DSO, and basically that's all.

When I'm writing it now, it looks like a simple, fast and pleasant task, but it was not. I was trying to emulate it many times, and when I programmed atmega32 wrongly, the DSO was freaking out and then I needed to get it back to normal state.

Lately I've bought clone of Selae Logic analyzer, and after connecting to those 3 signals I saw clearly what was happening, and I was right about that signals. If you consider to buy something similar, don't think too much about it - just buy, now I can't imagine my home lab without it. I used it one more time to check the 5bit SPI, but you can read it later in this post.

Keyboard protocol

As you can see, it's a little bit easier with logic analyzer ;)

This is only one part of keyboard protocol - the transmission from the user (bottom/knobs) to the Blackfin CPU. There is also in other way from Blackfin to leds that are under the buttons, but I really don't need them, so I just stick with those 3 lines.

Touch screen


The broken Prestigo PMP3270B would be proud that he's guts give some new features to my DSO, first the backlight, now the touch screen, he had also tiny wireless card, with pins that match USB port, but I'll check this other time.

I took the touch screen, look it carefully at data connector, and what a nice surprise, the data lines have additional soldering spots and all of them are marked!

Touch screen connector (on the left) and additional soldering points on the back of the chip (right).

I couldn't find exact datasheet for this one, so I connected touch screen to Bus Pirate and started to talk with it from python, to see if the similar commands will match, and it did :)

Display driver


When I was reverse engineering keyboard protocol, I looked once more to HX8817 datasheet. It appeared to have secondary input port. I thought that I could connect here something faster than atmega, and draw own menu on secondary video input, as a background for touch screen. So, when hitting defined touch area, display would be switched to secondary input and my beautiful menu will appear on the screen.

Yeah this would be something!

I have also OV7670 camera which has 8-bit parallel rgb interface, and I think I could connect it too, so the secondary idea was to have microscope like display on DSO - add better lens for OV* and use it during soldering very small parts.

But then ... I hit with reality, all pins of secondary input was connected together on PCB. I tired to cut the paths and connect directly to the HX8817 pins, but doing this with old, too big and broken soldering iron wasn't a good idea. I'll post only a picture how it was looking before, after it was like you hit it with a grenade or sth.

Secondary 8-bit parallel input

Agree, I f***** this up, but now when I bought better soldering iron, I could replace this chip with the good one ;) and finish one of my idea.

Just before this "issue" I've connected to the SPI port and it turns out that the addressing is not 8 but 5-bit, so I needed to write software SPI protocol (only for writes). With help came my newly bought logic analyzer. Just wrote some code, then check how it looks in Selae, make a correction, compare it with datasheet and it was done.

SPI connection, input only - no Data Output pin from slave (HX8817)

Now I can change gamma, mirror/flip the image and do some other stuff. This will be nice feature if I ever change housing for something else. This was good idea, you will agree with me later ;) especially with gamma correction. I needed to cut off the paths leading to Blackfin, and solder to driver side. Now I could configure driver only by arduino nano.


Wooden front


I like wood, it's easy to process, and at the end you just paint it on whatever color you like.

Old metal case

I removed the metal thing between USB port and BNC connectors, in more expensive models, this is used for some kind of extension slot.

Wooden front

Now back to the display:

Display + touchscreen + arduino nano as a driver and keyboard emulator

Together, after couple of black paint it looks like below. My wife approves it ;)

Black paint, everything mounted. Front made of wood

I removed rest of plastic housing and painted metal too

It looks good!

But ... it didn't work ...


The display was completely white. I thought that could be something with the SPI port, maybe I'm getting some noise from power supply. I disassemble, check and assemble it couple of times, but nothing really pointed what's going on here.

Finally I discovered that display data cable was damaged, it was very short, and placing it back in the connector was a real challenge, so probably i just pulled harder one time.

I bought a new display, and during shipment time, I connected the original 5.6". Gave it to my buddy from work before, he was so kind to borrow me it back just to test this.

On the 5.6" I could see something, but needed to look very close and from specified angle. I double check HX8817 driver, even connect the SPI back to Blackfin, that was a desperate act. Then I've started to check the parts close to the display connector socket and I found that the one of transistors had a short.
 
New transistor and additional cables used to check Vcom voltage

After replacing it with similar one, the 5.6" display started to work. Yeah! I've checked all other voltages to make sure that is all ok. The transistor was broken probably because I've made a short with broken display data cable.

Couple of days after, new display has arrived. I was happy as s***. Connected everything .... and no f***** image, just bright screen. The previous one, before the data cable was broken, was working ok, the 5.6" too, so ... I bought a 7" display with malfunction ... yay me!

Display was sold as a used part, I had a warranty for 30 days on it, but I removed (cut) the original frame before connecting the display to the motherboard and ...  I could put it you know where...

Ok, don't panic, what should I do? Buy another one? Nah, I've stared to manipulate displays Vcom voltage, and when I connect additional signal (noise) I could sometimes see something on it. So there was a chance ... something with Vcom, then I thought about HX8817 and gamma correction.

I disconnected SPI connection from Blackfin to HX8817, previously I've connected it like in original board to check if this is causing the problem, and started to manipulate gamma settings.

Finally I could see something on the screen, not as good as with the old 7" and original 5.6", but I can work on this.

Barely working display

If this display brakes down in some time, I'll bought a new one and HX8817, to realize my idea with OV7670 camera or with drawing menu as a background for the buttons on the touch screen.

Touch gestures and additional control


After the display started to work, I did some refactor in old code and speed up gesture recognition and general driver response.

At this day, as a test setup I have:

Buttons:
- menu
- trigger (auto mode)
- 5 buttons that was on the right side of original 5.6 display

Gestures:
- change horizontal offset: swipe right/left, one finger
- change time base: swipe out/in, two fingers
- change V div on channel 1 and 2: two fingers first finger selects channel, second finger makes a movement and changes the V div
- change V offset: swipe up/down in channel area, one finger

For additional control I've made very simple Qt application using python. It connects to arduino nano by RS232 and sends command. This is literally emulated keyboard, because Blackfin thinks that commands are send from hardware one.

I just need to figure out what buttons I'll put on touch screen, for sure I'll add Single, Run Stop, CH1 and CH2.

Custom Qt Python app to control all functions of my DSO

Future enhancements


Communication with the arduino is over RS232, I have the BTM-222 bluetooth module laying around somewhere. I thought to connect it to arduino, bind it by RFCOMM with my smartphone and write an app for android to control DSO from my phone over a bluetooth. It will be as simple as above Python Qt app, because I need only write one byte to arduino serial port, and bluetooth connection will be transparent thanks to rfcom.

Don't forget to see how it works, movie is on top of this page.

Finally fixed contrast!
Recently I was able to fix poor constrast on the display. I've changed charge pump negative voltage driving transistors from NPN to PNP and also one failed diode.

I also changed colors, so now it's black background :)

2 comments:

  1. I'm really impressed with the technical "know-how" you've displayed here. Top-notch work! I thought I was impressive as I had started to understand how the circuit boards on a PC work and felt it was a real achievement to have made my own, but this project is on an entirely different level.

    Raymond @ CKS Global Solutions LTD

    ReplyDelete
  2. Nice Blog, Thanks for sharing. Keep Sharing

    Do you want to buy Zero-Bezel Resistive Touch Screen Panels online?

    Buy Zero-Bezel Resistive Touch Screen Panels

    ReplyDelete