Tuesday, May 1, 2018

X-Ray detector / Geiger wannabe

Another small project from many moons ago from when I started collecting parts for building a small X-Ray machine. One of those simple yet important devices especially usefull when doing any kind of high voltage work and high vacuums.


It's a rather simple design made from scrap parts (except the Russian SI-39G detector tube) placed into a plastic project box with some holes for an indicator LED, headphone jack, recharging jack and power switch.


If I remember correctly the transformer is from a very old Point Of Sale CCFL backlight, that along with the high voltage zener diodes and detector tube are the only specialized parts. The rest is generic components all powered by a tiny LiPo that gets charged once every year or two.


Not much too it, after looking at lots of online schematics I wanted something with very low part count and regulated voltage so I'm pretty happy with the design.
I've had it for about 6 years maybe and have taken it to many places. It's quite interesting to walk around and placing it on granite and finding more active spots :)

Read More!

SPEBEG (Single Player Eight Bit Electronic Game)

Finally got around to finishing the last details of an old shcool project.
A simple 8bit game, aim with the joystick at the target and fire! Increase points and try to keep up with the increasing speed!



Here is a pretty much self explanatory video of the device.

The concept is pretty simple and the building blocks only required a little dab of logic glue and some filtering to get it up and running.

Starting from the Power Supply block it's a normal full bridge rectifier and a classic 7805 linear regulator. As the game needs a bit of randomness I decided to use the rectified input for a 100Hz clock. This clock is stable over long periods of time but has minor changes and this is where I'm getting the little bit of randomness. The 100Hz clock also handles the LED matrix time multiplexing between the User Input and the Target Generator blocks.

The secondary clock is provided by the venerable 555 IC pumping away at about 47KHz. This clock is fed into the Target Generator block.

The Target Generator block is based on 74190 BCD counters fed into 7442 Selectors. The end effect is a continued scanning of the LED matrix on the bus. This bus is fed into 74373 Latches that are triggered from the Delay block.

The Analog Input block are a pair of LM3914 bargraph drivers in dot mode and spitting out the result onto the 8bit bus.


A close up of the Power Supply, Secondary Timer, Analog Input and two thirds of the Target Generator blocks as well as the power input and joystic input.

The Delay block are another set of 74190 BCD counters set as frequency dividers for the 100Hz clock. The counters are loaded with the current score value so the higher the score the shorter the count delay and thus the game speeds up. There are four levels available. I have not scored much higher than 22 points on the lowest level...

The Delay block output is passed through a delay filter with clamps that then goes back to the Target Generator block to load the input of the 74373 latches onto the 8bit bus.

The Scoring block is yet again... more 74190 BCD counters fed into 7448 BCD to 7 segment display drivers. The input is provide via the Control Logic block.

The Comparator block simply compares the 8bit Analog Input and Target Generator buses with a pair of 74688 comparators and when triggered by the Fire button on the joystick send out a matching or not signal to the Control Logic block.

The Control Logic block is that dab of glue that holds it all together. In order to keep parts count down and use as less variety of IC's possible a classic 7404 NOT and 7408 AND gates were used.
The left (U7:A) AND gate will send a logic 1 when the trigger is pressed (logic 0) and the X comparator inputs match (another logic 0). The righ (U7:B) AND gate receives the logic 1 and again if the Y comparator inputs match will also output a logic 1.
The trigger and AND output is sent to the lower right (U7:C) after being inverted. If the user misses the target the output will reset the Scoring block and thus the Delay block will also reset to the maximum delay, the easiest speed.

The Bus Selector block handles what bus to send to the LED matrix with four 74157 demultiplexers, either the User Input or the Target Generator 8bit bus. This is handled from the 100Hz clock divided by two to get a 50% duty square wave.

The LED matrix display is driven with a 74540 and 74541 octal line drivers.

A closer view at the IC's.

The simple LED matrix and 7-Segment displays.

The ratsnest of point to point wiring with enameled wire.

The reason I bought my first temperature controled soldering station... Needed a fine tip with enough temperature to remove the enamel on the wire.

I'd never done point-to-point Wire Wrapping wiring like this, I tried to keep it tidy but the deadline was very close and the staggering 200€ worth of (localy sourced) IC's and long pin sockets really kept me going to get it finished. It worked in time : ) but had a few minor flaws that rendered it very hard to play : ( About 5 years later I dug it out and fixed all the issues. Back to storage it goes!

Well, thanks for reading. I'm going to try to update this blog a bit more frequently and actually finish projects instead of just leaving them as a proof of concepts.

Read More!

Saturday, September 6, 2014

Hacked up USB for a Phillips HDD1420 GoGear

MP3 players... getting shoved aside by smartphones. A hand me down that spent too much time at the back of a cupboard. Empty battery, no charger, no connector, no memory. How I brought the Phillips HDD1420 back to life!


The first attempt was to power the device via the battery conector only to be greeted with an error message insisting to conect the player to a computer... Tracing the connector I found some suspicous looking traces and soldered a USB cable to it. GND, D+ and D-. Nope... not working, checked the cable and it was defective, swap it for a better one and still nothing...



http://pinouts.ru/PortableDevices/philips_gogear_pinout.shtml

Looking at the information the USB pins I used are correct... maybe it needs the 5V from the USB? Need to probe the board to find a place to solder the 5V to... Bingo! We have communication! Mass storage device detected in Windows... but that's it. No disk drive shows up... Time to go to Phillips' website and find out what is going on. Fortunatly they have the "Phillips Device Manager" software that will reset you device to a working state!

Oh, I't doens't work on Windows 7? Ok, I'll try on an old Notebook running Windows XP...

Oh, I't can't find any devices to fix? If it's mass storage I'll just connect the 4GB Hard Drive Disk to the computer with a card reader (not all card readers support Microdrives, so keep that in mind)...

Oh, I't won't open the drive? I'll try another Microdrive... Yup it works fine...

Turns out the original Hard Drive is dead... Crack on the bottom of the player + non functional hard drive = Previous owner dropped it. OK! Let's replace the Hard Drive with an 8GB Microdrive...

Now windows shows a drive and lets me open it... but still no boot and a nice error message still telling me to connect it to a PC. Oh, and the "Device Manager" still doesn't find a GoGear Player.

Format drive, copy the official firmware to the drive in the correct directory but still not working...

After finding and reading the service manual it states that the technician must replace system files, so it sounds like there is more than just the firmware file...

Time to check if the awesome project RockBox supports the Phillips devices as the last time I checked there was not much support for various players. Of course they had it! Good ol' RockBox!

I used the RockBox installer and the player was booting up fine! Tried the Oficial Firmware and it booted great aswell.

This is where I could remove RockBox from the player and keep the original firmware, but I wanted to use RockBox. The problem was with charging. The GoGear HDD1*** Series come with an external power adapter for charging and the player can also charge over USB at either 100mA or 500mA.
The GoGear has a hardware IC that handles charging and power selection of either External Adapter (AC) or USB power. The IC is the BQ24032 from Texas Instruments. The OF handles the USB charging at either 100mA or 500mA via the control pins on the charger IC. However in the RockBox firmware this is not implemented as it is assumed that you have the external AC adapter.


Now, thanks again to RockBox for providing the schematics of the GoGear player I found a suitable test point for the external power input, a decoupling capacitor very close to the BQ24032 charge IC! Let the software hacking begin!

Now, the GoGear HDD1*** Series are powered by a PP5022B-TFF, This Portal Player System on a Chip (SoC) houses two 32-bit ARM7TDMI processors. It has many more features and is a 261 pin BGA IC. That is a lot of pins, and best of all there is no available documentation for it! To get RockBock running on this platform LOTS of work went into it. Fortunatly with some patience and looking at the source code for RockBox you can get a rought idea of what pin does what... except for the ones that are not used, like the USB charge current select of either 100mA or 500mA...

After much digging around the source code I found out how bits were SET or CLEARED in a pretty safe manner.
Do not change an INPUT to an OUTPUT unless you are sure of what you are doing. You could damage the PortalPlayer IC or the GoGear.
First decide witch GPIO port you want to modify, you can choose from A to L (8bit wide?) or the 32bit wide GPO.
To SET;
    GPIO*_OUTPUT_VAL |= 0xh;
    GPIO*_OUTPUT_EN  |= 0xh;
To CLEAR;
    GPIOB_OUTPUT_VAL &=~0xh;
    GPIOB_OUTPUT_EN  |= 0xh;
Replace * with a letter from A to L
Replace h with a hex value of the pins you want to change.

An IRC user by the nick pamaury suggested PortB and we determined that PortB.5 is the external power detect pin and PortB.2 is USB power detect. Pamaury also suggested PortB.1 based on his dissasembly of the OF as the current control pin ISET2 on the BQ24032 charge IC.

I decided to place the code in the bootloader to start the fast charging as soon as it boots.
Did I mention Rockbox has a Development Ubuntu image for VM's? Download, run, follow instructions!

Open up a terminal and...
-Get rockbox source code;
"git clone git://git.rockbox.org/rockbox ./Desktop/rockbox"
-Go to the rockbox directory;
"cd ./Desktop/rockbox"
-Make a new folder inside the rockbox folder;
"mkdir build"
-Go to the build directory;
"cd build"
-Setup the enviroment;
"../tools/configure"
-enter "101" for Phillips GoGear HDD1630
-enter "N" for Compiling the firmware or "B" for compiling the bootloader.
-Make the RockBox Firmware/Bootloader;
"make" or use "make -j 4" if you have a 4 core processor
-Make a zip if you want to move all of the files easily to the player;
"make zip"
-Extract the zip file to the device, safely extract the device and reboot it!

Now I also did some other tweaks here and there, so lots of transfering the firmware to the player was going on... switching back to windows to copy the files and extract the device was a pain. A little bit of glue and the proces was a simple as running a script!

To share a folder between the virtual machine and windows you will need to instal the Guest Additions CD image from the VM Device menu. Find a tutorial on how to get it running properly. I updated the Ubuntu OS.
Also I used RemoveDrive to set up a BATCH scrip that copied the files to the player and safely removed it from the PC;
copy %~dp0sharedfldr\build\rockbox.mi4 H:\.rockbox /Y
copy %~dp0sharedfldr\bootloader_build\FWImage.ebn H:\System /Y
"%~dp0RemoveDrive.exe" "GoGear"
This BATCH file gets launched from withing the virtual machine via a program called winexe thanks to the following line;
winexe -U user_name%password //192.168.1.100 "C:\Users\OiD-W\Desktop\Ubuntu\copy.bat"
So about 40 lines of code later and I have a little menu that can handle my lazy needs:


After digging around the code I have found the following interesting bits;
The header file for the main processor, pp5020.h, that contains lots of information about the chip.
Some examples of bit/port manipulation in button-hdd1630.c and lcd-hdd1630.c.
Power control code for handling charging is placed in the power-hdd.c file.
And of course the main thread in main.c as a starting point of the program.

For the bootloader there is main-pp.c and that is where I have placed my code for the high speed charging.

I'd like to make a menu option for enabling the charging and some other minor changes here and there. See if I can have a look at a few bugs and generaly mess around with the device. Then see if I can upload the code to the GitHub.

Once the USB pins were found a more robust solution was needed. I placed a mini USB conector from another media player and soldered it the original conector and a large ground pad where one of the screws went. I also used enammeled copper wire for the data signals. Looking back twisting them together wouldn't be a bad idea. The 5V orange wire is multicore and it should handle the 500mA without a problem. Not seen in the photo is a small wire from the GND pin of the USB connector to the chassis GND. This is important because cheap USB cables don't use the connector chassis for GND.

A small notch needed to be cutout from the rubber hard drive support.

And part of the metal chassis also needed to be cut out.

I had choosen to place the USB in its current position because one of the plastic clips that held the player together was broken. Turns out it was no the best of ideas... There is a small gap but that could be fixed by gluing the parts togther. I'll try to find a less permanent solution.
Also to note is the cut bezel of the original conector, a method of securing it is also needed.

Thanks for reading! Happy hacking!

Read More!

Wednesday, August 6, 2014

A Photoduino variation


Well, I'm sure someone has heard of the Photoduino. A DIY controller for cameras and flash units based around the Arduino.


The Photoduino has a bunch of sensors such as audio, light, pressure and can control various devices such a camera, flash units, laser, LED, solenoid and whatever you can plug in to it.
I  built mine based on the photoduino website and made a few changes, mostly software. The biggest difference is the screen, wich originaly is a small LCD with a parallel interface. I had this lovely VFD display lying around and it ended up in the project.

Now the VFD is a serial device so that meant changing the code and making the software play nice with it. While doing so I decide to do some modifications with the buttons, menus, configurations, multiple languadge support, volume control, extra control ports and provably other minor changes.
The software is based on version 9 and hence the ALT meaning alternative version.

A small mishap (or rather, a string of bad luck) meant burning:
2 Atmega328
1 Atmega8u2
1 USB to serial adapter
1 Disconfigured VFD
If you include the eBay shenanigans, other things breaking, burnt fingers, having to travel 200km for parts and forget something then you could say it was a pretty depressing week!


I never really figured out what killed the Arduinos. The VFD used to share the serial TX from the Arduino so when I programmed the sketch I had to remember to turn the display off or garbage would be displayed on the device. But worse than garbage is changing the configuration parameters of the VFD and it's subsequent lack of functionality, hence the 200km trip to pick up the original VFD wires, install a virtual windows XP (the software only works on XP or previous), setting the configuration and getting everything back up and running.
During this proces the USB adapter and Arduinos died. All 5V TTL signals, current limiting resistor on the serial lines, working in a ESD safe area, verifying the dead microcontrollers with AVRDude, all grounds connected... No idea of what happened.


The photoduino now runs on a damaged arduino with a dead Atmega8u2 programmed via ICSP and the VFD runs on a sofware serial pin with an apropiate current limiting resistor (even the atmega8u2 had resistors on the serial lines and died)


I finally got around to labelling the conectors, a great improvement in functionality! Well... more like less wasting time guessing which conector does what.
Another change is an extra IO used exclusively for IR remote control of the camera.


The cheapest enclosure I found is a storage box from a hardware store. Such a waste of space...


Actually it doubles as a container for the sensors, cables and power supply!


Did I mention L.A.S.E.R.? Everything is better with mighty lasers!


Oh, yeah! And a sample shot that left me with a very oily kitchen and popcorn everywhere!

Read More!

Tuesday, July 1, 2014

Mini flash with optical slave


Normally each year around christmas I will be involved in a couple of Secret Santas and one of them is a "all hand made" type where buying the gift is not allowed. Some very creative gifts have showed up!

Turns out I had to come up with something for a photographer... being one myself I know there are many usefull things to make but many are expensive or take a decent amount of time to build.
In comes a mini slave flash with an optical trigger!


Like many projects things don't tend to run to well on schedules so I deadbuged the circuit of a disposable camera flash so it would fit inside the case and have room for the battery (nope, didn't happen!). Here is the circuit diagram for the flash from Sam's repair faq.

http://www.repairfaq.org/sam/strbfaq.htm#strbkd2

In order to squeeze the battery inside of the case everything needed to be small and well laid out. Unfortunatly the transformer is what ultimately stop my from my goal. I had to come up with a small and simple trigger for the flash unit. Provably too simple if used in broad daylight, but i works reliably in bright artificial lighting.


Three components make up the trigger. This conects directly to the trigger pins of the flash circuit.


Here is a side view of the little flash unit.


And another from the back. The beam pattern is maybe a bit too wide but it'll do!


And a size comparison to a comercial flash unit.


So what could it be used for? Small spaces, highlights, inside objects... lots of uses!


The person I gave it too seemed to enjoy it quite a bit. I hope he can find a use for it.

Read More!