Archive

Author Archive

C# || .ToList() in .NET2.0

December 29, 2016 Leave a comment

Sometimes it is necessary to code with old framework, like 2.0.
It hasn’t .ToList() extension method for IEnumerable objects.

well, here it is :

static  public List<tsource>  ToList<tsource>(this IEnumerable<tsource> source)
{
IEnumerator<tsource> en = source.GetEnumerator();
List<tsource> list = new List<tsource>();
en.Reset();
while (en.MoveNext())
{
list.Add(en.Current);
}
return list;
}
bt_code_init('4df0288a-c0e9-48fe-ae6f-71460ffeb895');

Categories: Uncategorized

Raspberry Pi 3 totally headless setup with VNC @ WiFi

December 29, 2016 Leave a comment

Long time since last post.
Some notes here :

Objective : setup RPi 3 without the need for external display nor keyboard.

1. get NOOBS (2.1.0 used here)
2. format SD card as FAT (full capacity) – SDFormatterv4.zip used
3. extract NOOBS zip content to root dir of SD card
4. prepare wpa_supplicant.conf with your WiFi access details, then save it to root dir of SD card along other NOOBS files
Like this:

# /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid="YOUR_SSID"
psk="YOUR_WIFI_PASSWORD"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}

5. edit with unix-text-file compatible editor (like Cream gvim) file on SD card :
/os/Raspbian/partition_setup.sh

insert somewhere in the middle line :

if [ -e /settings/wpa_supplicant.conf ] ; then cp /settings/wpa_supplicant.conf /tmp/2/etc/wpa_supplicant/wpa_supplicant.conf ; fi

6. Have TightVNC or RealVNC installed on your PC/Mac.
7. Insert SD Card into RaspberryPi3 and power it on
8. Find IP of your RPi3 – easiest way -> look at website of your router (RPi3 should be named “recovery”)
9. Insert IP address into VNC viewer soft, and you’ll probably get ERROR 10061 – connection refused – that’s because you’re too late right now. NOOBS VNC connection server will be available only for few seconds after RPi bootup.
10. Power down your RPi3 (pull the power plug)
11. Tap connect on your VNC viewer and simultaneously power on RPi3 now – it should connect right now – you’ll see NOOBS installer with available options…

Howgh.

Of course there is one another problem – how to run headlessly raspi-config after successful install of Raspbian lite … 😉

EDIT: To allow SSH into newly installed system, you have to :
1. Put empty file named “ssh” (no extension) into root dir of your SD card (‘boot’ FAT-volume)

and it works great !

Categories: Uncategorized

PCD8544 | a command not very documented…

October 1, 2013 Leave a comment

Today I was getting some old nokia 3310 LCD back alive and found one kind of weird acting. The display was scrolled up by few lines. I get through datasheet but nothing useful seems to be found at first sight. Getting fed with it I wrote few lines to play over undocumented ones, or I should rather say, reserved commands.
The one I was looking for was obviously the last. (Hail to the Murphy!).
Switching the extended instruction set write(0x21,pin_DC=0) gives you access to 0x40 command, which presents analogy to its normal-instruction-set counterpart.
So, write(0x40 | y_offset,pin_DC=0) gives you Y-scroll or Y-shift command, in single line units.
Seems that controller has more than expected amount of DDRAM…

Cheers!

Categories: Uncategorized

JewelryBox & Mac OS X 10.8.3 – solutions…

September 27, 2013 Leave a comment

First of all, you need to have password for your user account. (It may seems silly, but it is required by sudo.
Then you have to sudo nano /etc/sudoers file and add line Defaults !requiretty.
Obviously install XCode 4.3+ and command_line_tools from Apple Dev.
After those simple steps, install & run JewelryBox and pick the right ruby you want.

Categories: Uncategorized Tags:

RFM22 Library update

December 14, 2012 11 comments

Greets,

During development of my tools and toys, RFM22 library evolved slightly. Still, it isn’t very commented, it lacks proper code partition into *.h and *.c, but it works (this is the one and only value I can find). Sorry. I’m providing it without any guarantee. Use it as it is, or as a reference, addressing functional details.

Here’s link  : ftp://83.143.101.132/RFM22.ZIP

Categories: Uncategorized Tags: , ,

Nokia N85 / N86 AMOLED interfacing (& surprise) …

October 23, 2011 27 comments

Have a look at it :

Notice that it is an AMDN001 marked module (which is, in fact, real AMOLED from N85/86).

Now the surprise : it works with the command set known from E51/6500c LCDs…
Yes! No changes, just solder the wires, build +5V/-5V DC-DC converter & Voilla…

The DC-DC can looks like : (I’ve managed to homemade it on 2.5×3.0cm single sided PCB).
n86_tps65136_sch

TPS65136 is available in QFN package only, its tricky to solder it at home, but having any hot-air & flux should do the trick. Remember that thermal pad should be GND-ed (& soldered too, of course).

UPDATE #1: There is one error in schematic – the L1 inductor should be 2.2uH or 4.7uH instead of 10mH (ekhm… “hardly available” 🙂 ).
To successfully drive this AMOLED it is sufficient to have such wiring : D0-D7, RES, WR, DC for control, and power sources : 3V3, ELVDD, ELVSS.
There is no need for 1V8 and level shifters like LVC4245. Driving VIO pin (12) with 3.3V voltage we’re getting whole interface bus working at 3.3V. (Don’t know exact timing impact with such voltage change, but it works at full speed achievable with PIC32MX parallel master port)

Nokia Display Modules Hacking Platform :)

October 18, 2011 5 comments

NDMHP in short 🙂 easy, huh ?

Today, I’ve got some hardware & software to share – In the meantime I’ve created some nice piece of hardware, and I named it as you can see above.
It consists of :
1). PIC32MX340F512H prototype board (PIC & necessary components to run it)
2). Voltage-level shifter based on LVC4245
3). Adapter board with voltage inverter & stabilizer (~+5V/-5V for amoled display) – not recommended to use, try to get TPS65136 (www.ti.com/product/tps65136) instead.
4). Power source with different voltages (1.8V, 2.5V, 3.3V, 5.0V, 12.0V)

Here comes some pictures of this crap :

Fig.1. PIC32MX proto-board


Fig.2. Level-shifter & n86 adapter board with DC-DC inverter & stabilizer


Fig.3. Photo of working AMDF001 connected to that crap above.

Here comes some schematics :
1) I would not provide you with proto-board of PIC32MX, because it is so self understandable, that it would be a shame to do this…
2) Level-shifter & n86 adapter board :
level_shifter_sch
n86_oled_adapter_sch

And some code, (very dirty but working…) :
https://rapidshare.com/files/2973078098/hack_n86_amoled.zip

Some description :
PC is connected to PIC32 via RS232 @ 57600 bauds (MAX3232 not visible – mounted inside COM1 plug, powered from PIC32 proto-board). PC is running C# program – win_amo_hack, PIC32 is flashed with included code (n86_amoled_hack).
Communication protocol PCPIC is described below :
– commands are sent as text strings
– commands :
a) ‘r’ – reset (assert RESX line low for 5ms & release high)
b) ‘C’ – pull chip select low (CSX=LOW)
c) ‘c’ – release chip select high (CSX=HIGH)
d) ‘i[xx]’ – write index register/execute command simple command (DCX=LOW, perform write of hexadecimal number [xx] via ParallelMasterPort, eg. “i29” – send DISP_ON command on MP1.0 protocol
e) ‘d[xx]’ – write single byte of data (DCX=HIGH, perform write of hex [xx] via PMP, eg. “d00” – send 0x00 to LCD)
f) ‘t’ – return tearing line status (returns t00 or t01 according to TE line level)
g) ‘g’ – read register or data (DCX=HIGH & perform read via PMP)

Examples:
“i01i11i29” – this string will initialize MP1.0 display (reset, sleep-out, display-on)
“i2cd00d11d22” – this string will send one pixel data (0x2c – GRAM_WRITE), color 0x001122

Win_amo_hack has also ability of execution of Lua scripts.
It defines two functions : amoSend & amoTear. First one takes single string argument & sends that string to PIC32. Second one returns TE line status as a byte.

Sample Lua script :
amoSend("Ci2ad00d00d00defc")
amoSend("Ci2bd00d00d01d3fc")

amoSend("Ci2c")
for y=0,319 do
for x=0,239 do
amoSend(string.format("d%02xd%02xd%02xd%02xd%02xd%02xd%02xd%02xd%02xd%02xd%02xd%02x",x,x,x,x,x,x,x,x,x,x,x,x))
end
end

Well, that’s basically it.
This platform is quite powerfull and can be used to hack multiple types of LCDs, as long as LCD is interfacing via Intel-80 parallel bus.

Have fun.

Nokia N85/N86 AMOLED display hacking project AMDF001 / AMDN001

October 9, 2011 Leave a comment

Well, after a while , I’ve found that E51-like LCD displays are barely readable in sunlight, which renders them unusable in outdoor conditions. So, after deep search, I’ve found nice and cheap potential solution : N85/N86 display.
It is active matrix OLED screen (AMOLED) 320×240, 2.58″, manufactured by (I believe) Samsung SMD (www.samsungsmd.com). There is markup on this OLED : AMDF001 AMDN001 (see below …) (which is probably FPCB model type (flexible printed circuit)). Other ID’s are : 4850084 (which is probably manufacturer ID code (see google)), MP1.0 which denotes interface protocol? (MeSSI ?)

Display have FPC 24-pin connector widely used by Nokia (same as E51), but different pinout is used – see N85/N86 schematic wiring diagram -> google it, download level 1/2 manuals.

Nokia uses codename Falcon for this display -> no effect after google.

What I’ve done :
1. As microcontroller I used PIC32MX (340F512H), communicating with PC via UART
2. I’ve created 2 prototype boards :
a) level shifter board (3.3V -> 1.8V) using 74LVC4245A (2x) one for databus D0..7, one for controls (RDX,WRX,RESX,DCX)
b) OLED display power supply (MC1727-500 & MAX889) generating -4.9V & +4.6V for ELVSS & ELVDD respectively.
3. I’ve dismounted 24 pin connector from display’s FPCB and soldered 24 wires to that connector’s pads (I’ve used old 80-pin ATA cable as a small wire donor)

After battle with my solder gun I finally ended up with working prototype, with NULL knowledge of protocol…

Digging the Web for similar display’s datasheets I’ve found that similar displays controllers using similar interface protocols, of course AMDF001 is using Intel 80 8-bit bus, just like E51 module.
It seems that it is using such protocol :

1. with DCX=0 write register addr (D0..7 => reg index)
2. with DCX=1 write data to that register … 8-bit or 16-bit??? (double 8bit transfers?)

After brute-forcing this module I’ve found that it is responding to commands (screen blinks, fades in/out, eventually even GRAM memory contents showed up on screen, nice)

Now it is long road to descramble the protocol & register locations…

Or maybe someone has something to say in this topic ???
Any help appreciated!

Update #1 : After days of digging the net searching for possible driver IC that drives this amoled, I’ve found that:
1) probably I have problem with connection bus (amoled seems to respond randomly to sent commands)
2) amoled is responding only when (sic!) LVC4245 is driven reversed (pic<-amoled) on data bus… strange..
3) I personnaly think that IC might be LD9014 from LDT,inc.
4) I really don't think it is S6E63D6X, just because of 262K color depth instead of proclaimed 16.7M for this amoled

Update #2 : Shame on me! These modules I got aren’t AMOLEDs… They turn out to be cheap chinese fakes – LCDs, looking like AMOLED, but they’re not.
Waiting for new delivery, hoping for getting real AMOLED now for n85/86.
Bloody differences ? Here you’ve got :
1) Shorted pins 11 & 12 (EL_ON VIO), gives constant 1.8V on EL_ON…
2) There is small BGA packaged IC on the FPCB just below the screen ( on the back side) – it is probably dc-dc charge pump for LED backlight (very smartly hid below the screen), original AMOLED has only some discrete smd parts on FPCB…
3) real AMOLED has MP2.1 protocol designation & AMS258DN01 module type (driver IC still unknown)

Update #3 : Module marked AMDF001A is an ordinary TFT module compatible with MP1.0 protocol, just like E51 module. Only pinout & backlight driving are different.
Still waiting for AMDN001 modules (which should be amoleds)

Categories: LCD, PIC32, Project Tags: , , , ,

Custom controls design & testing…

For a former Delphi-ist like me, creating custom components was almost an everyday routine, but after switching to more modern & versatile enviroments like C# (VS2010) I’ve found myself lost in the docs & lack of knowledge about such important thing.

However, things are easier than they appear to be.
There is one strange dead-end, called User Controls – well, it is nothing else but a control made of other controls – it is group of controls compiled under one typename…
To create & test your own custom control, you should extend already existing class (like System.Windows.Forms.Control or System.Windows.Forms.Button… etc.)

Suppose, you’re working on an application, and you wan’t to use a new control (e.g. slightly modified MaskedTextBox), follow this route :
1. In your app solution create another class (Add… / Class, Shift+Alt+C)
2. Name it as you want, like MyMaskEdit.cs
3. use your app namespace, or another else (remember to add appropriate usings
4. change the default declaration of your newly created class to something like :


namespace A
{
namespace B
{
[System.ComponentModel.DefaultBindingProperty("Time")]
public class DBTimeEdit : System.Windows.Forms.MaskedTextBox
{
...
}
}
}

Categories: C#

Project attempt: Pulseoximeter

December 19, 2010 1 comment

Source :
http://www.oximeter.org/PulseOx/principles.htm
http://www.edaboard.com/attachments/24135d1178378436-cc2004-12_2018-pdf
http://www.edaboard.com/attachments/24304d1179237986-ti_app__notes_for_pulse_oximetry_1486-pdf
http://www.circuitcellar.com/microchip2007/winners/DE/abstracts/MT2278_Abstract.pdf
http://www.cypress.com/?rID=2696

Did some basic research…

Description of operation :
The device uses 2 LEDs, one bright red (about 640nm) and one IR (about 910nm). These LEDs transflects the finger (or other suitable tissue), and the light gets into sensor.
Sensor can be a photodiode (such as BPW34), or Light-to-Frequency converter (like TSL230…)
Because I cannot obtain TSLxxx (the easier solution), I’m forced to use photodiode BPW34.
Using TSLxxx leads to “almost” pure digital solution, simply introducing TSL’s output into InputCapture module of MCU, counting pulses, some digital filtering, AC part extraction & showing up results.
Photodiode is a bit trickier… Signal is very small, I have to use instrumentation amplifier with very low drift as an input opamp (transimpedance approach), filter DC part of the signal, extract the “pulse” wave, amplify it and then sample via ADC (then filtering, calculations & ->LCD).
There are many analog part solutions to this problem, but I didn’t find the one I could repeat.
(Cypress’ version is very sophisticated, but I cannot find any “cheap” PSoC chip near my localization, combining it with need for new programmers/debuggers rendering it very far from acceptable…)

Do you have any ideas, how to design analog part of this project ?