Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Reputation Activity

  1. Like
    chibiace got a reaction from BlackAngel in Nokia 5110 LCD ADC Graph   
    Hey, here is a little piece of code i cobbled together so that i could visualize my adc input and get a value reading along with it.

    when the line reaches the end of the screen it starts again from the beginning and erases the old line, which was the simplest way i could think of doing it
    the communication is bitbang and works on msp430g2231 and barely fits on there, tips on how to slim down my flashed code size would be very welcome.
    thanks to other members on this forum whom i borrowed small bits and pieces from.
    very fun to adjust the delays and amount of samples to see sine waves appear from a floating input pin.

    #include "msp430g2231.h" /* Program for MSP430G2231 to display a Graph,ADC and Voltage on a Nokia 5110 Lcd _____ VCC -| M G |- GND SCLK -| S 2 |- NC DIN -| P 2 |- NC DC -| 4 3 |- TEST CE -| 3 1 |- RESET RST -| 0 |- NC LED -|_____|- ADC */ //Define Pins for LCD + Backlight LED and ADC #define SCLK BIT0 #define DIN BIT1 #define DC BIT2 #define CE BIT3 #define RST BIT4 #define LED BIT5 #define ADC BIT6 //Font for ADC and Voltage Display static const char font[][5] = { {0x40, 0x5f, 0x51, 0x5f, 0x40} //0 ,{0x40, 0x40, 0x40, 0x5f, 0x40} //1 ,{0x40, 0x5d, 0x55, 0x57, 0x40} //2 ,{0x40, 0x55, 0x55, 0x5f, 0x40} //3 ,{0x40, 0x47, 0x44, 0x5f, 0x40} //4 ,{0x40, 0x57, 0x55, 0x5d, 0x40} //5 ,{0x40, 0x5f, 0x55, 0x5d, 0x40} //6 ,{0x40, 0x41, 0x41, 0x5f, 0x40} //7 ,{0x40, 0x5f, 0x55, 0x5f, 0x40} //8 ,{0x40, 0x47, 0x45, 0x5f, 0x40} //9 ,{0x40, 0x5e, 0x45, 0x5e, 0x40} //A ,{0x40, 0x5f, 0x51, 0x4e, 0x40} //D ,{0x40, 0x5f, 0x51, 0x51, 0x40} //C ,{0x40, 0x4f, 0x50, 0x4f, 0x40} //V }; const int write = 1; const int instruction = 0; void init(void); void clear(void); void shift(unsigned int, unsigned char); void cha(unsigned int ch); int main(void) { //Change me to suit. unsigned int samples = 5; unsigned int sampledelay = 1200; unsigned int loopdelay = 60000; //delay cycles unsigned int supplyvoltage = 3600; //mV //Int Hell int e;int i;unsigned int b=0b00000001;unsigned int j=0;int h;unsigned int l=5; //Arduino Value Map long map(long x, long in_min, long in_max, long out_min, long out_max) {return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;} //Disable Watchdog Timer WDTCTL = WDTPW + WDTHOLD; //Pin Directions P1DIR |= SCLK+DIN+DC+CE+RST+LED;; P1OUT |= LED; //ADC Setup Channel 2, ADC10CLK/4 ADC10CTL1 = INCH_6 + ADC10DIV_3 ; //Vcc & Vss as reference ADC10CTL0 = SREF_0 + ADC10SHT_3 + ADC10ON + ADC10IE; ADC10AE0 |= ADC; ADC10CTL0 |= ENC + ADC10SC; init(); clear(); //Set Cursor shift(instruction, 0x40 | 0); shift(instruction, 0x80 | 0); //Draw Font cha(10); //A cha(11); //D cha(12); //C shift(write, 0x4A); //: for(e=0;e<34;e++){shift(write, 0x40);} //_____ cha(13); //V: shift(write, 0x4A); //: for(e=0;e<32;e++){shift(write, 0x40);} //_____ //Main Program Loop while(1){ //ADC Read e=0; for(i=0;i<samples;i++){ ADC10CTL0 |= ADC10SC; while(ADC10CTL1 & ADC10BUSY); e=e+ADC10MEM; __delay_cycles(sampledelay); } e=e/samples; //Map ADC to graph e=map(ADC10MEM,0,1023,0,40); //Write ADC and Voltage values shift(instruction, 0x40 | 0); shift(instruction, 0x80 | 20); cha((ADC10MEM)/1000%10); cha((ADC10MEM)/100%10); cha((ADC10MEM)/10%10); cha((ADC10MEM)%10); shift(instruction, 0x80 | 60); h=(long)ADC10MEM*supplyvoltage/1023; cha(h/1000); shift(write, 0x50); //decimal point cha(h/100%10); cha(h/10%10); cha(h/1%10); //Clear lines shift(instruction, 0x40 | 1);shift(instruction, 0x80 | j);shift(write, 0x00); shift(instruction, 0x40 | 2);shift(instruction, 0x80 | j);shift(write, 0x00); shift(instruction, 0x40 | 3);shift(instruction, 0x80 | j);shift(write, 0x00); shift(instruction, 0x40 | 4);shift(instruction, 0x80 | j);shift(write, 0x00); shift(instruction, 0x40 | 5);shift(instruction, 0x80 | j);shift(write, 0x00); //Drawable values for graph if (e<=40) {     if (!e) e=1;     e = 40-e;     b = 1<<(e%8);     l = (e/8)+1; } //Set cursor at write point and write shift(instruction, 0x40 | l); shift(instruction, 0x80 | j); shift(write,; //"Scrolling" j++; if(j==85){j=0;} //Loop Delay __delay_cycles(loopdelay); }} //Clears the whole display void clear(){ int e; for(e=0;e<588;e++){shift(write,0x00);}} //Draws Font void cha(unsigned int ch){ int e; for(e = 0; e < 5; e++) { shift(write, font[ch][e]);} } void init(void){ P1OUT &= ~SCLK+DIN+DC+CE+RST; __delay_cycles(50000); P1OUT |= RST; P1OUT &= ~CE; //Sets up the display, your settings may vary: shift(instruction, 0x21); shift(instruction, 0xC5); shift(instruction, 0x12); shift(instruction, 0x20); shift(instruction, 0x09); shift(instruction, 0x0C); P1OUT |= CE; } //Serial Communication with LCD void shift(unsigned int mode, unsigned char byte){ if (mode==instruction){P1OUT &= ~DC;} else if(mode==write){P1OUT |= DC;} P1OUT &= ~CE; unsigned char i; for(i=0;i<=7;i++){ P1OUT &= ~SCLK; if(byte>127){P1OUT |= DIN;} else if(byte<128){P1OUT &= ~DIN;} P1OUT |= SCLK; byte = byte<<1; } P1OUT |= CE; }
  2. Like
    chibiace reacted to rebeltaz in launchpad or independant   
    I guess I am just old school. On the last project I built - a MSP-based nixie clock - I drew the board patterns out on a piece of paper by hand, transferred the patterns to the copper clad with a sharpie and cut the traces out with a dremel tool and a hobby knife. Sure.. it may take more time, but I have the satisfaction of knowing that I actually did it by hand.
    @@chibiace - I like the board. I made one of those myself,  just with a longer cable. I also connected another cable that terminates in a 20-pin socket that I can plug into a breadboard to take the place of jumper wires from the headers. I'll post a photo of it later.
    I appreciate the responses, guys...

  3. Like
    chibiace got a reaction from Samartist in 4x4x4 LED cube, using 3 pins of MSP430 launchpad   
    very tidy man, love it.
  4. Like
    chibiace reacted to Samartist in 4x4x4 LED cube, using 3 pins of MSP430 launchpad   
    This is my 4x4x4 led cube project, done with MSP430, using only 3 pins of MSP, the circuit diagram is shown in the photos, the hardware consists of 3 shift registers, 74595, and 4 NPN transistors...

    you can learn how to make a 4x4x4 LED cube by instructables or youtube or some other sites, its easy to make...
    but make sure that you make exact same connections as shown in the cicuit diagrams... or else this code won't work in the new hardware...

    the hardware can be built as shown in the circuit diagram...

    the code is given below, you can changes it and make your own animation with it....
    this is what i have done with the cube...

  5. Like
    chibiace reacted to simpleavr in 1 Battery (JT) Power Source for MSP430 Launchpad ^_^   
    it's fun to experiment, i tried w/ success on attinys long time ago. again depend on the application (i.e. how u draw current).
    ti has this application note http://www.ti.com/lit/an/slaa105/slaa105.pdf which requires 4 transistors + some common components.
    i always wanted to try but never get to it.
  6. Like
    chibiace reacted to bluehash in Giveaway Winners: Cubeberg's Launchpad 4-Relay BoosterPack   
    The following are the winners of the raffle Cubeberg's Launchpad 4-Relay BoosterPack:

    1. Place: @RenierSF1

  7. Like
    chibiace reacted to cubeberg in Relay Booster   
    Here is a Relay boosterpack that I'm planning on using for a couple of things.  

    There are a couple of units available on Tindie.
    First - I built a wireless fireworks launcher last year for the 4th of july using the Anaren booster.  Unfortunately the range was much too short - so I'm hoping to use a pair of NRF24L01's.  The relays work great to trigger nichrome wire.
    Second - I'm helping a co-worker out with a home-automation project.  The relays work great as a dry-contact.  
    One of the reasons why I went with creating a booster was to make sure the traces were nice and large - in case I needed it to run something beefy.  Most relay boards I've found online have fairly thin traces.  I used all available space (top and bottom) to make mine as large as possible.  If you take a look at the pictures of the board - you'll see the large planes for NO/NC and COM for the relays.  I haven't tested yet - but based on a PCB trace width calculator - they should be able to take several amps.  Might be good for solenoids or really beefy motors.

    Some additional info:
    Relays are numbered on the board - Relay 1 is in the upper-left.   NO and NC are labeled next to the screw terminals - the center is common. Power for triggering the relays is provided via a two-pin header at the bottom of the board.  For testing, I've been using a 9v battery.   Latch and Enable pins are selectable via a set of small jumpers on the back.  The testing code I've provided are set for Enable - 2.2 and Latch - 2.3.  2.2 through 2.5 are available for selection for either feature. The board doesn't use opto-isolators - so only DC should be used.  
    BOM - Parts are all Tayda
    SOIC 595 Shift Register (1)
    ULN2003AD SOIC Darlington Array (1)
    ~1K Pull-up Resistor (1)
    1N4006 Rectifier diode or similar (4) - These serve as protection diodes
    Relays (4) - I used 6v relays - but the footprint fits plenty of other types of mini relays
    3 Position, 3.5mm terminal block (4)
    Eagle files are attached.  
    Here is a sample program for CCS.  Pushing button 1 
    #include <msp430.h> /* * main.c */ #define CS_595 BIT3 //P2 #define ENABLE BIT2 //P2 #define SCL_PIN BIT5 //CLK #define SDA_PIN BIT7 //Data to 595's #define DISABLE_SR P2DIR |= ENABLE; P2OUT |= ENABLE #define ENABLE_SR P2DIR &= ~ENABLE; P2OUT &= ~ENABLE #define SR_DESELECT P2OUT &= ~CS_595 //Select shift register #define SR_SELECT P2OUT |= CS_595 //Deselect shift register #define BUTTON BIT3 #define RELAY_1 BIT1 #define RELAY_2 BIT2 #define RELAY_3 BIT3 #define RELAY_4 BIT4 #define TEST_DELAY 5000000 //Function prototypes void initSPI(); void write(char relays); int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer //configuration from GRACE BCSCTL2 = SELM_0 + DIVM_0 + DIVS_0; if (CALBC1_16MHZ != 0xFF) { /* Adjust this accordingly to your VCC rise time */ __delay_cycles(100000); /* Follow recommended flow. First, clear all DCOx and MODx bits. Then * apply new RSELx values. Finally, apply new DCOx and MODx bit values. */ DCOCTL = 0x00; BCSCTL1 = CALBC1_16MHZ; /* Set DCO to 16MHz */ DCOCTL = CALDCO_16MHZ; } BCSCTL1 |= XT2OFF + DIVA_0; BCSCTL3 = XT2S_0 + LFXT1S_2 + XCAP_1; //INTERRUPT ON 1.3 - Pull up resistor enabled P1IE |= BUTTON; P1IFG |= BUTTON; P1REN |= BUTTON; P1OUT |= BUTTON; P1IFG &= ~BUTTON; P1DIR |= BIT0|BIT6; P1OUT &= ~(BIT0|BIT6); _bis_SR_register(GIE); initSPI(); ENABLE_SR; LPM0; //sleep until button press while(1) { P1OUT |= BIT0|BIT6; write(RELAY_1|RELAY_2|RELAY_3|RELAY_4);//all on _delay_cycles(8000000); //half second P1OUT ^= BIT0; write(RELAY_2|RELAY_3|RELAY_4);//turn off 1 _delay_cycles(8000000); //half second P1OUT ^= BIT0; P1OUT ^= BIT6; write(RELAY_3|RELAY_4);//turn off 2 _delay_cycles(8000000); //half second P1OUT ^= BIT0; P1OUT ^= BIT6; write(RELAY_4); //turn off 3 _delay_cycles(8000000); //half second write(0x00);//turn off all P1OUT &= ~(BIT0|BIT6); //turn off all LEDs LPM0; } } //Set up USCI_B for SPI void initSPI() { P1DIR |= SCL_PIN|SDA_PIN; P2DIR |= CS_595; SR_DESELECT; P1SEL |= SCL_PIN + SDA_PIN; P1SEL2 |= SCL_PIN + SDA_PIN; UCB0CTL0 |= UCCKPH + UCMSB + UCMST + UCSYNC; // 3-pin, 8-bit SPI master UCB0CTL1 |= UCSSEL_2; // SMCLK UCB0BR0 |= 0x01; // div/1 UCB0BR1 = 0; UCB0CTL1 &= ~UCSWRST; // Initialize _delay_cycles(5000); } /* * Outputs relay settings to booster */ void write(char relays) { SR_SELECT; UCB0TXBUF = relays; //this will end up on the second shift register while (!(IFG2 & UCB0TXIFG)); //wait for send to complete SR_DESELECT; } // Port 1 interrupt service routine #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { //P1OUT ^= 0x01; // P1.0 = toggle P1IFG &= ~BUTTON; LPM0_EXIT; } RelayBP_Eagle.zip
  8. Like
    chibiace got a reaction from Oppa in What do you think of this scope / price ?   
    i think the scope to get at this time might be the rigol ds1102e, the ds1052e would be better if you could find an older model which can be hacked to 100mhz. plenty of reviews on youtube. 
    and there are some popular owan products too. 
    personally cant really justify a scope at this price as i can use a multimeter for my current projects. if they come down 100$ then perhaps. 
  9. Like
    chibiace reacted to mechg in PowerScope   
    43oh Store link   I found myself wanting a dedicated power monitor to use while developing battery-powered application circuits, so I built one using the MSP430G2402.    http://code.google.com/p/powerscope/   This device has already helped me identify and eliminate about 40% of the power usage of a project in-progress.   Right now, I just have the code as a zip file on the download tab, but if anyone wants to develop additional features, I can check the code into Subversion and create some branches.    The board can be ordered for about $12 (for 3 boards) by uploading the Eagle .brd file to http://www.oshpark.com I don't make any money from oshpark.   Greg Glenn
  10. Like
    chibiace got a reaction from rebeltaz in Coffee Pot Fish Tank   
    well done.  
  11. Like
    chibiace got a reaction from kerplatz in Need a RTC clock   
    if you scale up you would probably want that external rtc. ds3231 is nice if you get samples of them. but there are afew 8 pin chips like the one posted above that will do a real good job for data logging.
    555 timer would be nice the performance should be similar to an internal timer without crystal im guesssing :-P
  12. Like
    chibiace got a reaction from abecedarian in It's the end of the world as we know it   
    we're all going to die!! oh the humanity wont somebody think of the children!!
  13. Like
    chibiace reacted to abecedarian in It's the end of the world as we know it   
    ... and I feel fine.
    ... in response to the "headline" at the top of the site.
    "That's great it starts with an earthquake, birds and snakes, an airplane and Lenny Bruce is not afraid...."
  14. Like
    chibiace got a reaction from RobG in Electronic LED Dice   
    Here is a project i worked on just before christmas last year. my main use for this has been to ask it a question like a magic 8 ball and recieve an answer ranging from 1=no 6=yes


    Bottom (strip/vero board is lovely to work with):

    lol no current limiting resistors.

    im not too sure where ive put the code, but the msp430g2231 sits in Low power mode 4 until it recieves a button press interrupt
    then it runs rand() and displays the number then back to sleep, ill try to keep looking for my main.c it will be around somewhere.
    battery still good 9 months later.
  15. Like
    chibiace reacted to cde in Best way to convert ADC to a string?   
    Take a look at some of the "printf" functions that people have made.
    For example
  16. Like
    chibiace reacted to RobG in Best way to convert ADC to a string?   
    Also, see those 2
  17. Like
    chibiace reacted to cde in Nokia 5110 LCD help.   
    Yep, lph7366 is the standard Nokia 5110 compatible lcd. How do you have it connected? The pinout is different, but it's pretty much labeled with the required lines. Unless the boards (or lcds) are badly labeled, or broken, it should work. The boards are basically just breakout adapters, no logic on them at all.
  18. Like
    chibiace reacted to SugarAddict in MSP430 Launchpad v1.5 to MSP430 Launchpad v1.4 Resolder   
    Yeah, I've got hot air for removal of stuff. edit: soldered it on the new board by hand though.

  19. Like
    chibiace reacted to SugarAddict in MSP430 Launchpad v1.5 to MSP430 Launchpad v1.4 Resolder   
    Yesterday I unsoldered everything from a v1.5 that I had broke and put it all on a printout of the launchpad board.  Today I soldered it all back on, with some bonus', to one of the bare 1.4 boards that was kindly provided to us.  It's probably not something I plan on doing again, but I've done it and it works.  Got my Com22 LP back and it's nicer than before :grin:  (Tested with G2553 LF xtal NMI example, as I did solder an xtal to it.)

    Thank you LariSan!
  20. Like
    chibiace got a reaction from pine in Project idea seeking comments - golf swing   
    how are you supposed to compare your data when you dont know what a good swing looks like?
    perhaps one of those wii motion plus thingies and the socket adapter, i think they are i2c, might not be fast enough. but might be handy for prototyping.
    bluetooth data could be sent after a swing?  how to initialize the capture or if the values look like a swing it captures and sends it?
    would you need accurate timing?
    i can easily imagine a small stick board with usb rechargeable battery and a case that clips tightly on to the club.
    and an android and iphone app with different coloured line graphs. lol
  21. Like
    chibiace reacted to rbasoalto in Very simple IR remote   
    I made a very simple IR remote control with a MSP430G2211, a 4x4 keypad, and an IR LED.
    I wanted to make a remote for my car radio, but for the time being, it's a Sony TV remote.
    You can see the code (mspgcc) at https://github.com/rbasoalto/sonyremote
    A couple of pictures...

    The code could use a little rework, but for a quick&dirty hack, it's working pretty nice.
    Keypad IR LED MSP430G2211 + socket Resistor for RST (it's inside the socket) Decoupling cap (probably not needed) Salvaged iPod Li-ion battery AMS1117-3.3 regulator (just the one I had lying around...) Assorted connectors Perf board  
    Next steps:
    Program new codes using keypad. Add a receiver module to enable learning of new codes. Higher power IR, using a transistor or MOSFET and a couple of high-intensity IR LEDs
  22. Like
    chibiace reacted to selcukc in nokia 5510   
    so good and thanks
  23. Like
    chibiace got a reaction from GeekDoc in Launchpad v1.4 PCBs FREE with Every Order   
  24. Like
    chibiace got a reaction from SugarAddict in Cost breakdown of Seeed   
    now if only eagle would do 10x10 boards on the free licence.
  25. Like
    chibiace got a reaction from abecedarian in Controlling a Relay   
    wait didnt you want to use a 12v relay?
    anyway same thing, 
    12v Positive to Relay+
    Diode from Relay- to Relay+
    Relay- To Transistor Collector
    Msp430 P1.0 to Resistor
    Resistor to Transistor Base
    Transistor Emitter to 12v Ground and Msp430 Ground connected together
  • Create New...