Skip to main content

Topics

This section allows you to view all Topics made by this member. Note that you can only see Topics made in areas you currently have access to.

Topics - arhi

62
Project development, ideas, and suggestions / CnCs
look at RAMPS ... http://reprap.org/wiki/Ramps

it is arduino mega shield that has drivers etc ...

You can use any of the available reprap firmware's for arduino:
http://reprap.org/wiki/Microcontroller_ ... stallation
http://reprap.org/wiki/Teacup_Firmware
or any other ..

Note that most of them don't parse g-code on the arduino but parse it on the host (hence your cnc is computer controled and not stand alone) but they all work nicely and are great starting point to go forward (and should be super simple to recompile on 32mx)
63
Logic Pirate / assembled and working :)
Finally got few hours free to assemble logic shrimp (got the pcb via mail from Ian some time ago)...

Two major issues with it ..

1. buffer, the one I have (LVC573A) is narrow and wide package so pins can't touch both sides :( so I have to add some wires or to make some solder bridges hence it does not look very nice

2. I had no 20MHz smd oscillators so I had to order some, I ended up with CTZ CTX750FBC a citizen oscillator, 3v3 power, 100ppm, same pinout as the schematic imho..

After I assembled the board, powered it on, there's no clock going from the output of the oscillator. Vdd measures 3v3 but scope show output of the oscillator is 0V :(

Oscillator is properly soldered I'm pretty sure (check pics), after it didn't work I heated it up with reflow gun and solder reflowed nicely, the oscillator was held with solder surface tension, cooled down .. same thing ..

I don't have time to play with it any more today but if anyone have any ideas where to go from here, lemme know. (If not I'll remove the oscillator in few days when I get another hour to play with it and try to use "big" 20MHz oscillator instead
64
Project logs / rc servo scan with pic16F690
I'm preparing to start some large project and decided to use my 10ch futaba remote control for it. Now, since this is rather new (FASST 10CG) remote control there is no digital signal on the receiver that I can tap into. The receiver do have some "digital lines" and can work with futaba HUB but I failed to find any reliable data on it and when attached scope to all the outputs of the received I was unable to make it peep anything but a simple PWM signal.

What I measured is that periode length is 14ms, that min signal length (calibrated fully down pushed fully down) is 970us and that max signal lenght (calibrated fully up, pushed fully up) is 2120us, while center point is 1520us.

I looked trough my drawer to find some pics and I still have some 16F690's so I decided to use it... it has interrupt on change both on A and B port + it has internal oscillator and bunch of analog pins. I decided to use them all. Read data and send it over serial port.

There are few issues.
1. hw serial TX pin is on RB7 and this is also the on-change pin. PICC also allows me to use sw rs232 protocol but with it either you want to disable interrupts while sending over rs232 or you can have "doggy" data going out. If you disable interrupts you will miss some events on the pin changes - not a big deal but "next" read will probably be wrong as you will miss half of the event so you'd have to implement some max/min error checking. I did some tests and 90% of characters went over ok without disabling interrupt so if you want to implement some fail safe reading on the client it could be ok, but I think sacrificing this one interrupt pin would be ok to use hw usart. Anyhow there is define at the beginning of the code that allows you to use hw or sw usart

2. RA4 and RA5 are interrupt on change pins but also OSC1/OSC2 so if you want to use external oscillator - you have to forget about them as your "on change" ... measurements are pretty accurate (0.5us) with internal 8MHz oscillator if you believe in the oscillator itself being accurate. In my project I will start using internal oscillator as I think it will not make too many issues for me - but I will switch to external if it looks like internal is making problems.

3. DAC takes time ... since there are not enough on change pins I'm using 6 remaining analog inputs. One could use them for some external sensory but I will use them in a way that PWM output from RC receiver will go trough simple 10k/10uF RC filter and then into some op-amp to swing it 0-5V so I can read pwm output values as analog value. Precision here will be way lower then on digital inputs but since my remote has few buttons that are actually with only few positions (2 or 3 positions) that will be more then enough. Unfortunately reading DAC on pic takes time, especially when you change channel, so there is also define at beginning of the code where you can disable analog section of the program.

Finally, here's the code:
Code: [Select]
// File servoDecoder.c
//
// Measures the signal length and sends it via serial port
//
// Author Bogdan Kecman <bogdan.kecman at crsn dot rs>
// Licence: I don't care - aka do what ever you like with the code, just don't bother me about it but it would be cool if you credit my work if you use it
//

// comment out any of these defines if you do not want it
#define __USARTHW__
#define __HSOSC__
#define __ANALOG__

#include <16F690.h>
#device adc=10
#FUSES NOWDT, NOPROTECT, NOBROWNOUT, NOMCLR, NOCPD, NOPUT, NOIESO, NOFCMEN

#ifdef __HSOSC__
  #FUSES HS
  #use delay(clock=20000000)
  #define RESOLUTION 0.2
#else
  #FUSES INTRC_IO
  #use delay(clock=8000000)
  #define RESOLUTION 0.5
#endif

#ifdef __USARTHW__
  #use rs232(baud=14400,parity=N,bits=8,UART1)
#else
  #use rs232(baud=14400,parity=N,xmit=PIN_C4,rcv=PIN_C5,bits=8)
#endif

#use fast_io(A)
#use fast_io(B)
#use fast_io(C)
#case

//volatile unsigned int16 brojac;


//servo channel values
volatile unsigned int16 S0; //A0
volatile unsigned int16 S1; //A1
volatile unsigned int16 S2; //A2
volatile unsigned int16 S3; //A3

#ifndef __HSOSC__
  volatile unsigned int16 S4; //A4
  volatile unsigned int16 S5; //A5
#endif

volatile unsigned int16 S6; //B4
volatile unsigned int16 S7; //B5
volatile unsigned int16 S8; //B6
#ifndef __USARTHW__ 
  volatile unsigned int16 S9; //B7
#endif

volatile unsigned int16 start0;
volatile unsigned int16 start1;
volatile unsigned int16 start2;
volatile unsigned int16 start3;

#ifndef __HSOSC__
  volatile unsigned int16 start4;
  volatile unsigned int16 start5;
#endif

volatile unsigned int16 start6;
volatile unsigned int16 start7;
volatile unsigned int16 start8;

#ifndef __USARTHW__
  volatile unsigned int16 start9;
#endif

volatile unsigned int8 stateA;
volatile unsigned int8 stateB;
volatile unsigned int8 overA;
volatile unsigned int8 overB;
volatile unsigned int16 T;

#ifdef __ANALOG__
  //analog pins
  volatile unsigned int16 A0; //C0 (AN4)
  volatile unsigned int16 A1; //C1 (AN5)
  volatile unsigned int16 A2; //C2 (AN6)
  volatile unsigned int16 A3; //C3 (AN7)
  volatile unsigned int16 A4; //C6 (AN8)
  volatile unsigned int16 A5; //C7 (AN9)
#endif



#int_RB
void  RB_isr(void) {
 
  T = get_timer1();
  overB = stateB ^ input_b();
  stateB = input_b();
 
  if (overB == 0) goto RA; //no changes on portB
 
#ifndef __USARTHW__ 
  if (bit_test(overB,7)){ //B7 S9
    if (bit_test(stateB,7)){
      start9 = T;
    }else{
      S9 = T - start9; //I can get here +1 if it wraps around zero but it can be ignored
    }
  }
#endif

  if (bit_test(overB,6)){ //B6 S8
    if (bit_test(stateB,6)){
      start8 = T;
    }else{
      S8 = T - start8;
    }
  }

  if (bit_test(overB,5)){ //B5 S7
      if (bit_test(stateB,5)){
      start7 = T;
    }else{
      S7 = T - start7;
    }
  }

  if (bit_test(overB,4)){ //B4 S6
    if (bit_test(stateB,4)){
      start6 = T;
    }else{
      S6 = T - start6;
    }
  }




// no INT_RA on 16F690 but changes on portA are treated like changes on portB
// (RABIF - single interrupt flag for both is used)
RA:


/* 
}

#int_RA
void  RA_isr(void) {
*/

 
  T = get_timer1();
  overA = stateA ^ input_a();
  stateA = input_a();
 
  if (overA == 0) return; //no changes on portA
 


  if (bit_test(overA,0)){ //A0 S0
    if (bit_test(stateA,0)){
      start0 = T;
    }else{
      S0 = T - start0;
    }
  }

  if (bit_test(overA,1)){ //A1 S1
    if (bit_test(stateA,1)){
      start1 = T;
    }else{
      S1 = T - start1;
    }
  }

  if (bit_test(overA,2)){ //A2 S2
    if (bit_test(stateA,2)){
      start2 = T;
    }else{
      S2 = T - start2;
    }
  }

  if (bit_test(overA,3)){ //A3 S3
    if (bit_test(stateA,3)){
      start3 = T;
    }else{
      S3 = T - start3;
    }
  }

#ifndef __HSOSC__

  if (bit_test(overA,4)){ //A4 S4
    if (bit_test(stateA,4)){
      start4 = T;
    }else{
      S4 = T - start4;
    }
  }

  if (bit_test(overA,5)){ //A5 S5
    if (bit_test(stateA,5)){
      start5 = T;
    }else{
      S5 = T - start5;
    }
  }
#endif

}



void main()
{
#ifdef __ANALOG__
  setup_adc_ports(sAN4|sAN5|sAN6|sAN7|sAN8|sAN9|VSS_VDD);
  #ifdef __HSOSC__
    setup_adc(ADC_CLOCK_DIV_32);
  #else
    setup_adc(ADC_CLOCK_INTERNAL);
  #endif
#else
  setup_adc_ports(NO_ANALOGS);
  setup_adc(ADC_OFF);
#endif

  setup_spi(SPI_SS_DISABLED);
  setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
  setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
  setup_timer_2(T2_DISABLED,0,1);
  setup_comparator(NC_NC_NC_NC);
#ifndef __HSOSC__
  setup_oscillator( OSC_8MHZ );
#endif
 
  start0 = 0;
  start1 = 0;
  start2 = 0;
  start3 = 0;
#ifndef __HSOSC__
  start4 = 0;
  start5 = 0;
#endif
  start6 = 0;
  start7 = 0;
  start8 = 0;
#ifndef __USARTHW__ 
  start9 = 0;
#endif

  stateA = 0;
  stateB = 0;
  //brojac = 0;

  set_tris_a(0xFF);
  *0x96 = 0xff;      //IOCA

#ifdef __USARTHW__
  set_tris_b(0xEF);  //B7 rs232 TX
  set_tris_c(0xFF);
  *0x116 = 0x7f;    //IOCB (B7 rs232 TX)
#else
  set_tris_b(0xFF);
  set_tris_c(0xEF);  //C4 - rs232 TX
  *0x116 = 0xff;    //IOCB
#endif

  enable_interrupts(INT_RB);
  //enable_interrupts(INT_RA);
  enable_interrupts(GLOBAL);
 
while1:

    //RESOLUTION is T1 resolution in microseconds   
    printf("%f, %f, %f, %f, ", S0 * RESOLUTION, S1 * RESOLUTION, S2 * RESOLUTION, S3 * RESOLUTION);
#ifndef __HSOSC__
    printf("%f, %f, ", S4 * RESOLUTION, S5 * RESOLUTION);
#endif
    printf("%f, %f, ", S6 * RESOLUTION, S7 * RESOLUTION);
    printf("%f", S8 * RESOLUTION);
#ifndef __USARTHW__           
    printf(", %f", S9 * RESOLUTION);
#endif

#ifdef __ANALOG__
    set_adc_channel(4);
    delay_ms(1);
    A0 = read_adc();
    printf(", %Lu", A0);
   
    set_adc_channel(5);
    delay_ms(1);
    A1 = read_adc();
    printf(", %Lu", A1);

    set_adc_channel(6);
    delay_ms(1);
    A2 = read_adc();
    printf(", %Lu", A2);

    set_adc_channel(7);
    delay_ms(1);
    A3 = read_adc();
    printf(", %Lu", A3);

    set_adc_channel(8);
    delay_ms(1);
    A4 = read_adc();
    printf(", %Lu", A4);

    set_adc_channel(9);
    delay_ms(1);
    A5 = read_adc();
    printf(", %Lu", A5);
#endif

    printf("nr");
    goto while1;
}

it uses CSC PICC and fills up only 50% of the pic .. so plenty more room for other stuff in .. (like checking if read data is in range etc..). There is no PCB/Schematic as you'd want to add this pic to a "project" where you need it to decode data from receiver and send data to your "brain" mcu via serial line ... I was thinking also to add i2c but I needed the lines for other stuff ...

Hope you can use it :D
65
Project development, ideas, and suggestions / The "Engineer's Assistant" probe
I used superprobe for some time, great device... if I remember correctly there was even a version of firmware written in C (with some changes to it - some "useless stuff" like NTSC signal were removed and some other stuff added).

There is another similar project (imho lot better)
http://www.qsl.net/la9sja/electronics/ea/index.html
http://www.microchip.com/stellent/idcpl ... e=en027166

it would be cool to modify it to work with some newer pic's .. I also seen some interesting i2c oled on seeed (arrived but still had no time to test it)... if you want to contact the author I can probably find it (as he's from this parts of the world)
66
General discussion / potentiometers
current selection pot on my made in PRC "lab psu" died so I replaced it .. now, as I had few of these "pot in pot" potentiometers (attached is how they are connected internally) I replaced the original "regular" pot one with same value (6k8) pot in pot ... (good that I had proper value) .... the precision of current selection is awesome now :D .. I can select 0.1mA without a problem (with original one 10mA was minimal selectable step) ... anyhow, that's not important ... the actual question is - how the hack are these pots called and can anyone point them to me at farnell/digikey/sureelectronics/itead/seeed as I only have few left and they rule :D (they are not classic multi turn pots, it is actually pot in a pot so you select "region" where you want to have fine adjustment .. it is really hard to explain if you don't see it from picture or try it yourself)
67
General discussion / weird button on bench top digital multimeter (very old)
Hi guy's

I have some old (very old) KONTRON DMM 3002 bench top digital multimeter and I like the old bugger as it works very fast and is pretty precise .. but, there is a button on the thing that I have no clue what it does, nor I managed to figure it out doing trial and error procedure. I opened and immediately closed the device as it is not something I want to thinker with (looks like it has AD converter made out of discrete parts)

So if you look at the pic, the button in question is the pressed one, or if not clear which one is pressed, the one with "--" sign.

Anyone have any ideas?
68
Project logs / 2.3″ Two Digits 7-Segment LED Information Board MTO
not "really" a project but I ordered bunch of 7seg modules from sure and I noticed on the product page lot of ppl complained about lack on info on how to drive them. As I plan to use them (for some clock as I don't see well without glasses so I want to make something I can see from bed without first trying to find my glasses) I spent few moments to figure out how they work, made some functional schematic (not really a true schematic but good enough for the "how to drive this" purpose) and put some simple example code in picc for 16f690 (I had that one on the table already so ... it is 3 wire control, really no need to get anything powerful :D ... )

it might be easy to make a buspirate macro to drive them but not sure how useful that would be :D ... I used buspirate for initial bit banging to find out where each segment is positioned... (I'm still on some age old firmware there, but it works so had no need to upgrade it :D )

anyhow, the schematic, source, some txt 2.3″ Two Digits 7-Segment LED Information Board MTO blog post on my blog (this one is in English contrary to most of posts there that are not)
69
General discussion / good and cheap usb microscope
I currently use some contraption I made out of
 - security camera (composite video output)
 - usb tv card (some pctv something)

the security camera lens was unscrewed almost completely so the focus point is ~2cm from the glass and this allows me to inspect the pcb. The IR light ring on the camera helps a lot here too :).

The problem is that I can only use this for inspection, there is no way to use it to view the solder pads while soldering them as I need to keep camera very close to the pcb. If I change the focus point and put camera on larger distance I lose the magnification and even on my 25" screen the quality is not that good. On top of all that the usb tv card don't have some crazy resolution .. lets say 640x480 is real resolution there ... 720xwhatever exists but it looks like quality is worse then 640x480

Now - the question ... anyone have experience with some USB microscope that can be ~4-5cm away from the pcb with good DOF that will have real time view on the screen (preferably to work with linux too) that will output 720p or similar resolution?

(attached is what I have now)
70
General discussion / ti purchasing national semi ... april joke or ?
I just received email
Quote
I am excited to let you know that TI has signed a definitive agreement to purchase National Semiconductor, uniting two industry leaders that have a common commitment to solving your analog needs. I want to reinforce TI's commitment to you, our customer, as we merge our two companies.

This acquisition will allow us to address your analog needs with a product portfolio of unmatched breadth and depth. National's 12,000 products plus TI's 30,000 means more performance, power and packaging options when selecting the right ICs for your application. And we'll provide a common set of best-in-class online tools to make the selection and design process easier.

Our combined sales and applications team of 2,500 will be larger than any in the industry so we can provide more customers with greater face-to-face support than ever before.

Our manufacturing operations will offer more capacity to support your growth. TI's fabs and National's available capacity can enable higher production levels.

While both companies will operate independently pending the close, our goal thereafter is to make the integration process as seamless as possible. No requalification of products will be necessary since National's manufacturing sites will continue to be utilized. Part numbers from both companies will remain the same. There will be no obsolescence of products.

I'm excited about what the integration of our two companies will mean for you: an unmatched portfolio to meet your analog needs, an extensive sales and applications network to ease the design process, and manufacturing capacity to support your growth.

You can learn more about the acquisition at www.ti.com/acquire, including answers to frequently asked questions and video messages from TI leaders regarding the acquisition.

Thank you for choosing TI. I look forward to a great future together.

Best regards,

Rich Templeton
Chairman, President and CEO
Texas Instruments

is this a spam/scam/april fools joke ...
71
Project logs / hid bootloader and linux
Waiting for the usable open source usb stack I'm still using Microchip's usb stack and often I use also Microchip's hid boot loader. The major problem I have with the boot loader is that I don't have windows (I run single instance of xp inside virtualbox and that is the only win available for miles).. Today I needed it again and I decided to try to rewrite the windows client app to work on Linux. I tried for 20 min to compile the darn thing directly but I gave up and decided to rewrite it as cli... few hours later I got it working ...

It is not fancy, just a cli that takes filename as input but .. works great :)

more info:
http://elco.crsndoo.com/wordpress/2011/ ... rom-linux/

source (and Fedora14 64bit binary): http://elco.crsndoo.com/files/hid_bootloader.tar.bz2

The app should work with any mcu using microchip's bootloader (18f, 24f, 32f ..) but I tested it only with 18F2550. I also modified original bootloader to activate if PGC+PGD is closed instead to waste B4 pin (the 18F2550 bootloader is here: http://elco.crsndoo.com/files/USB%20Dev ... 50.hex.bz2 )

If someone want to "beautify" the code, add "options" (like reset after program, erase only ..) it is fairly fast and easy now when this skeleton works .. I might be adding it too .. maybe even add some gui .. but for now this works for me..
73
Project development, ideas, and suggestions / Up to 60MHz 8bit logic analyzer
I got me a FT2232H Mini-Module some time ago as I wanted to test the high speed chip mostly because the spec show that this chip can do in hw what buspirate does in sw... What got me interested is it's FT245 synchronous mode - darn thing is bloody fast and today I finally found some time to check it out.

I whipped up a small program (tested on linux, uses openGL (glx) to display data, no idea if it can be compiled on windows but if you have cmake it might work - I don't have windoze to test it - I will attach source in a sec, not that it is something revolutionary :D it's few hours of coding only)....

How does it work? First you must use FT_Prog to set your A channel to FT245 hw. When this mode is turned on the B channel stop working as all resources are used by FT245 on channel a.

FT245 allow read or write to be performed. In the write mode (from the external hardware point of view, so you are writing to ftdi chip, hence your computer is reading from the DUT) the 2232h produces 60MHz clock on the CLKOUT pin (AC5 pin). When ready to receive 2232H will lower the TXE (AC1) pin down (the pin will go high if you don't read the data from the 2232H so it's buffers fill up) and it will get it back high if it is unable to receive data. The data on AD0-AD7 will be written to 2232H on every CLKOUT clock when WR (AC3) pin is low. For the test I shorted TXE and WR pins so that data is read on every CLKOUT hence having 60MHz readout of the 8 data bits on the AD.

In order to change scanning speed an additional circuit would be required so that WR pin can be triggered on every N'th CLKOUT. A small CPLD capable of running at 60MHz would be great choice. Anyhow, with fast enough client we can exctract data at whatever speed below 60MHz we want, it is just matter of processing 8bit wide stream :)
75
Bus Pirate Development / microchip usb stack
I noticed that many projects that are open source (different licences) leave out microchip libraries out of the code (bp uses usb lib but leaves it out, the similar issue can be seen in other project with fat/sd/usb and many other microchip libs). Looking at the headers in these sources from microchip I don't see why are the sources excluded from the projects? The only thing I see in the microchip licencing info is that those are not to be used on non microchip mcu-s, but since all this projects (BP for one) use microchip mcu (PIC24.. for e.g.) there should be no problem ?!

Anyone can shed some light on to this issue?

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.01582486984session_write_close ( )...(null):0
20.01622618592ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.01622619368Database_MySQL->query( ).../DatabaseHandler.php:119
40.05922758120Database_MySQL->error( ).../Db-mysql.class.php:273