Jump to content
43oh

ILAMtitan

Members
  • Content Count

    56
  • Joined

  • Last visited

  • Days Won

    3

Reputation Activity

  1. Like
    ILAMtitan got a reaction from KatiePier in First actual fried MSP430   
    You got off easy.  I do a lot of work with mains voltage, and learned my lesson about debugging without an isolated interface early on.  THis one blew out my laptop's dock as well in the process.
     

  2. Like
    ILAMtitan reacted to grahamf72 in Vetinari's Clock   
    I've improved the code a little, so here is my updated version. Fixes include:
    1. Using a bit array instead of a byte array, dramatically reduces the amount of RAM used, so that smaller MSP430's can be used. I have been using an F2012, only because it was the cheapest DIP MSP430 my supplier had on hand. It should compile and work with pretty much any of the low end processors. I've tested with the F2012 & G2452, but it also compiles with the G2231, so I'd expect it should operate fine.
    2. Previously while the motor was turned on, it used a simple __delay_cycles loop for the timeout. This is quite heavy on power. I have changed it so it utilises TimerA so that it can go down to LPM3 while it is providing the motor pulse.
    3. The original code had a bug in that when the coil was off, both PNP transistors were turned on. PNP transistors turn on when their base is brought low, and since in the idle state the original code set those pins to 0, both transistors were turned fully on. This didn't result in current flowing through the motor, but base current was constantly flowing through the transistors - approx 3mA each.  This sapped battery life.
    With the original code, I was getting about 1 month on a pair of AA alkaline batteries. With my changes I've had a clock running for about 6 months now.
    /****************************************************************************** * * Project : Vetinari Clock * Target CPU : MSP430G2553 * Compiler : CCS 5.2.1 * Copyright : None * Version : $Revision: 1A * \file main.c * \brief The Vetinari clock is from a book series known as Discworld, where * Lord Verinari has a clock in his waiting room which has an irregular tick. The * idea of the clock is to add a sense of unease and anxiety to anyone in the waiting * room since their brain doesn't filter out the ticks like a normal clock. * * To accomplish this task on a 430, we create an array of possible time frames to * tick the clock, and parse through it at 4Hz. The array is 32 entries long, so it * equates to 32 seconds in the real world. By randomly setting 32 of the elements high, * we create a timing sequence. A high element will generate a tick of the clock. This * means a second on the clock can be as little as 250ms, or as long as 24 seconds, and * still keep accurate time. ***************************************************************************** * * Code modified by Graham Fountain to: * Use a bit array instead of byte array. This is much more RAM efficient and * allows a smaller 128B device to be used instead of needing a 256B device. * Tested with an MSP430F2012 (which at the time was the least expensive MSP430 * in DIP casing my supplier had in stock). * * The delay code that conrols how long the pulse is delivered to the motor * has been changed from a simple __delay_cycles to use TimerA. This allows us * to drop into LPM3 mode while the motor is pulsing, saving considerable power. * In my tests, a pair of AA batteries lasted about 1 month with the __delay_cycles * code, while they lasted more than 6 months with the TimerA code. * *********************************************************************** * * H Bridge Configuration. * The below code is configured for the below configuration of the * H Bridge. If you use different pins to control transistors then * use different values for COIL_OFF, COIL_ONE & COIL_TWO * * V+ ----------------+-----------+ * | | * E E The top two transistors are PNP, eg BC557 * P1.3<---RESISTOR---B B---RESISTOR--->P1.2 * C C * | | * +---MOTOR---+ * | | * C C * P1.1<---RESISTOR---B B---RESISTOR--->P1.0 * E E The bottom two transistors are NPN, eg BC547 * | | * GND ---------------+-----------+ * * * *****************************************************************************/ #include "msp430.h" #include <stdint.h> #include <stdio.h> #include <string.h> /* Defines - Too lazy to put these in a header, maybe later */ /* How many clock cycles cycles to keep the io high * This will chgange depending on the model of clock movement used */ #define ENERGISE_TIME 820 //time in 1/32768 clock cycles. 820 = 25mS /* IO Mapping */ #define COIL_OUT P1OUT #define COIL_DIR P1DIR /* H-Bridge control pins */ /* * NB: PNP Transistors are ON when low, OFF when high * NPN Transistors are OFF when low, ON when high */ #define COIL_OFF (BIT2 | BIT3) //Both PNP's high (off), Both NPN's low (off) #define COIL_ONE (BIT2 | BIT0) //B0101 PNP on P1.3 on, PNP on P1.2 off, NPN on P1.1 off, NPN on P1.0 on #define COIL_TWO (BIT3 | BIT1) //B1010 PNP on P1.3 off, PNP on P1.2 on, NPN on P1.1 on, NPN on P1.0 off /* Lazy man globals*/ static uint16_t timingSequence[8]; //8 x 16 bits = 128 bits inline uint16_t GetBit(uint16_t x) //get the current value of bit x { return (timingSequence[x>>4] >> (x & 0xF)) & 0x1; //x>>4 is our index to the array (top 3 bits). x & 0xF is the bit we want. } inline void ClearAllBits() //0 the array. This loop takes less code than memset { for(int i=0;i<8;i++) timingSequence[i]=0; } inline void SetBit(uint16_t x) //set bit x of the array { timingSequence[x>>4] |= (1<< (x & 0xF)); } inline void delay() //delay for the period specified by ENERGISE_TIME. { TA0CCR0= ENERGISE_TIME; //set what we will count to. TA0CCTL0 = CCIE; //enable CCR0 interrupt TA0CTL = TASSEL_1 | MC_1 | TACLR; //ACLK (the crystal), count up, reset any value currently in the timer LPM3; //wait until the interrupt happens. TA0CCTL0 = 0; //reset the timer TA0CTL =0; } /* * send a pulse to the clock coil */ void pulseClock(void) { /* the polarity on the coil must swap each time it ticks, so we need to keep track of it */ static uint8_t polarity; if (polarity == 0) { COIL_OUT = COIL_ONE; delay(); COIL_OUT = COIL_OFF; polarity = 1; } else { COIL_OUT = COIL_TWO; delay(); COIL_OUT = COIL_OFF; polarity = 0; } } /* * Using a LFSR, generate a "random" 16-bit number. This was snagged from wikipedia */ uint16_t get_rand(uint16_t in) { uint16_t lfsr = in; static unsigned bit; static unsigned period = 0; /* taps: 16 14 13 11; feedback polynomial: x^16 + x^14 + x^13 + x^11 + 1 */ bit = ((lfsr >> 0) ^ (lfsr >> 2) ^ (lfsr >> 3) ^ (lfsr >> 5) ) & 1; lfsr = (lfsr >> 1) | (bit << 15); ++period; return(lfsr); } /* * Reset the clock sequence, runs every 32 seconds */ void ResetSequence(void) { uint8_t i=32; uint8_t location; static uint16_t feedback = 0xACE1; /* Zero out all elements */ //memset(&timingSequence, 0x0, sizeof(timingSequence)); ClearAllBits(); /* The array needs to have 32 random elements set high. * To do this we generate 32 different random numbers to use as indexes for the bits that will be set high. * If the index is already set, we just discard that number and try for a new one. */ do{ /* get a new random number */ feedback = get_rand(feedback); /* We only want the lower 7 bits since it's a 128 element array * The 16-bit number is still used so that we get a longer * chain in the LFSR before it repeats */ location = 0x7F & feedback; /* If the random location has already been set high, we ignore the random number */ if(GetBit(location) == 0) { /* Other wise we set the element */ SetBit(location); /* and decrement the counter */ i--; } /* This needs to be done 32 times */ }while(i); } /* * I setup the MSP, and run the main program loop */ int main(void) { /* counter to determine when 32 seconds have past */ uint8_t counter = 0; if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF) { // If calibration constants erased, do not load, trap CPU!! while(1); //G_uc_SystemFailureCode = McuCalValueFail; } // Set DCOCLK to 1MHz DCOCTL = 0x00; BCSCTL1 = CALBC1_1MHZ; DCOCTL = CALDCO_1MHZ; /* setup watchdog for a .25s interval * WDT ISR set at watchdog_timer(void)*/ WDTCTL = WDT_ADLY_250; IE1 |= WDTIE; /* Enable Osc Fault */ IE1 |= OFIE; /* Setup IO */ COIL_DIR = COIL_ONE | COIL_TWO; COIL_OUT = COIL_OFF; /* Initialize the pulse sequence */ ResetSequence(); /* Enter LPM3 w/interrupt */ _BIS_SR(LPM3_bits + GIE); while(1) { /* If this element of the sequence is high, we need to tick the clock */ if (GetBit(counter)) { pulseClock(); } /* Increment the counter to get us closer to 32 sec */ counter++; /* The WDT runs at 4Hz, so 32sec at equates to 128 ISR firings * At the 32 sec mark, we want to reset the counter and generate a new pulse sequence */ if (counter == 128) { counter = 0; ResetSequence(); } /* Enter LPM3 w/interrupt */ _BIS_SR(LPM3_bits + GIE); /* Once the WDT interrupt fires, it will return here looping back to the start of the while loop */ } } #pragma vector=TIMER0_A0_VECTOR __interrupt void timera0 (void) { _BIC_SR_IRQ(LPM3_bits); //we don't need to do anything but make sure we are woken up. } /* * The watchdog timer is actually useful */ #pragma vector=WDT_VECTOR __interrupt void watchdog_timer (void) { /* Clear LPM3 bits from 0(SR) * This will send us back to the main while loop */ _BIC_SR_IRQ(LPM3_bits); } /* * Just in case */ #pragma vector=NMI_VECTOR __interrupt void nmi_ (void) { uint16_t i; do { IFG1 &= ~OFIFG; // Clear OSCFault flag for (i = 0xFFF; i > 0; i--); // Time for flag to set } while (IFG1 & OFIFG); // OSCFault flag still set? IE1 |= OFIE; // Enable Osc Fault }
  3. Like
    ILAMtitan got a reaction from tripwire in First actual fried MSP430   
    One more fried board, courtesy of a colleague of mine.  I know it's not an MSP, but the LM3S parts make some pretty patterns when you hit with mains voltage.  Just another reminder to always triple check when working with HV.
     

  4. Like
    ILAMtitan got a reaction from KatiePier in Vetinari's Clock   
    I figured you guys might be interested in some of my tinkering with the Launchpad.  Hopefully by putting a few of my projects up here it will also keep me accountable for finishing them.
     
    This is one a cobbled together a few months ago.  It's been up on the MCU projects page on E2E, so you might have already seen it: http://e2e.ti.com/group/microcontrollerprojects/m/msp430microcontrollerprojects/664670.aspx
     
     
    PROJECT OVERVIEW
    The Vetinari clock is from a book series known as Discworld, where Lord Verinari has a clock in his waiting room which has an irregular tick. The idea of the clock is to add a sense of unease and anxiety to anyone in the waiting room since their brain doesn't filter out the ticks like a normal clock. Here's a video to get a better idea of the result.  The tick is actually a lot louder in person.
     


     
    SOFTWARE DESIGN
    To accomplish this task on a 430, we create an array of possible time frames to tick the clock, and parse through it at 4Hz. The array is 32 entries long, so it equates to 32 seconds in the real world. By randomly setting 32 of the elements high, we create a timing sequence. A high element will generate a tick of the clock. This means a second on the clock can be as little as 250ms, or as long as 24 seconds, and still keep accurate time.  Check the attached software too see how it's all done; I did my best to comment it up.  main.c
     
    HARDWARE DESIGN
    The clock coil is driven via an alternating polarity pulse.  The easiest way to change a load's polarity with an MCU is using an h-bridge.
     

     
    The schematic shown is a simple implementation using two NPN and two PNP transistors.  I had the transistors and drive resistors laying around, so this part was easy to cobble together (along with the half used battery holder).  It would be easy to use a single IO pin per side of the bridge, but the transistors fit better onto the launchpad, as shown in the image.  To add the driving resistors in series, I cut a small gap in the traces, scrapped off the solder mask on either side to make pads, and put down a small SMA resistor.  It's not pretty, but it works.
     

     
    In the clock mechanism, there is a small control board with a crystal and epoxy glob IC that normally runs the clock.  I just ripped that out and directly attached the coil to the h-bridge.
     

     
    The resulting clock is actually more maddening than I expected in a quiet environment.  By using 3V rather than the 1.5V that the original movement used, the ticks are much more pronounced and do an excellent job of ruining a person's calm.
  5. Like
    ILAMtitan got a reaction from rampadc in Vetinari's Clock   
    I figured you guys might be interested in some of my tinkering with the Launchpad.  Hopefully by putting a few of my projects up here it will also keep me accountable for finishing them.
     
    This is one a cobbled together a few months ago.  It's been up on the MCU projects page on E2E, so you might have already seen it: http://e2e.ti.com/group/microcontrollerprojects/m/msp430microcontrollerprojects/664670.aspx
     
     
    PROJECT OVERVIEW
    The Vetinari clock is from a book series known as Discworld, where Lord Verinari has a clock in his waiting room which has an irregular tick. The idea of the clock is to add a sense of unease and anxiety to anyone in the waiting room since their brain doesn't filter out the ticks like a normal clock. Here's a video to get a better idea of the result.  The tick is actually a lot louder in person.
     


     
    SOFTWARE DESIGN
    To accomplish this task on a 430, we create an array of possible time frames to tick the clock, and parse through it at 4Hz. The array is 32 entries long, so it equates to 32 seconds in the real world. By randomly setting 32 of the elements high, we create a timing sequence. A high element will generate a tick of the clock. This means a second on the clock can be as little as 250ms, or as long as 24 seconds, and still keep accurate time.  Check the attached software too see how it's all done; I did my best to comment it up.  main.c
     
    HARDWARE DESIGN
    The clock coil is driven via an alternating polarity pulse.  The easiest way to change a load's polarity with an MCU is using an h-bridge.
     

     
    The schematic shown is a simple implementation using two NPN and two PNP transistors.  I had the transistors and drive resistors laying around, so this part was easy to cobble together (along with the half used battery holder).  It would be easy to use a single IO pin per side of the bridge, but the transistors fit better onto the launchpad, as shown in the image.  To add the driving resistors in series, I cut a small gap in the traces, scrapped off the solder mask on either side to make pads, and put down a small SMA resistor.  It's not pretty, but it works.
     

     
    In the clock mechanism, there is a small control board with a crystal and epoxy glob IC that normally runs the clock.  I just ripped that out and directly attached the coil to the h-bridge.
     

     
    The resulting clock is actually more maddening than I expected in a quiet environment.  By using 3V rather than the 1.5V that the original movement used, the ticks are much more pronounced and do an excellent job of ruining a person's calm.
  6. Like
    ILAMtitan got a reaction from maelli01 in Vetinari's Clock   
    I figured you guys might be interested in some of my tinkering with the Launchpad.  Hopefully by putting a few of my projects up here it will also keep me accountable for finishing them.
     
    This is one a cobbled together a few months ago.  It's been up on the MCU projects page on E2E, so you might have already seen it: http://e2e.ti.com/group/microcontrollerprojects/m/msp430microcontrollerprojects/664670.aspx
     
     
    PROJECT OVERVIEW
    The Vetinari clock is from a book series known as Discworld, where Lord Verinari has a clock in his waiting room which has an irregular tick. The idea of the clock is to add a sense of unease and anxiety to anyone in the waiting room since their brain doesn't filter out the ticks like a normal clock. Here's a video to get a better idea of the result.  The tick is actually a lot louder in person.
     


     
    SOFTWARE DESIGN
    To accomplish this task on a 430, we create an array of possible time frames to tick the clock, and parse through it at 4Hz. The array is 32 entries long, so it equates to 32 seconds in the real world. By randomly setting 32 of the elements high, we create a timing sequence. A high element will generate a tick of the clock. This means a second on the clock can be as little as 250ms, or as long as 24 seconds, and still keep accurate time.  Check the attached software too see how it's all done; I did my best to comment it up.  main.c
     
    HARDWARE DESIGN
    The clock coil is driven via an alternating polarity pulse.  The easiest way to change a load's polarity with an MCU is using an h-bridge.
     

     
    The schematic shown is a simple implementation using two NPN and two PNP transistors.  I had the transistors and drive resistors laying around, so this part was easy to cobble together (along with the half used battery holder).  It would be easy to use a single IO pin per side of the bridge, but the transistors fit better onto the launchpad, as shown in the image.  To add the driving resistors in series, I cut a small gap in the traces, scrapped off the solder mask on either side to make pads, and put down a small SMA resistor.  It's not pretty, but it works.
     

     
    In the clock mechanism, there is a small control board with a crystal and epoxy glob IC that normally runs the clock.  I just ripped that out and directly attached the coil to the h-bridge.
     

     
    The resulting clock is actually more maddening than I expected in a quiet environment.  By using 3V rather than the 1.5V that the original movement used, the ticks are much more pronounced and do an excellent job of ruining a person's calm.
  7. Like
    ILAMtitan got a reaction from GeekDoc in 3D printed G2LP and 5529LP bumpers/cases   
    I was able to extract the cover from Garrett's STL file and extend it a bit to fit the TRF-7970 NFC BoosterPack.  I added 6mm to it as you can see here:
     

     
    It should be able to fit with many other Boosters as well, but I haven't really tested it out.
     

     
    It sits only a few mm off of the Booster PCB so that the NFC tag is close to it.
     

     
    And here's the file for you guys to play with. 7970_5529Top.zip
  8. Like
    ILAMtitan got a reaction from KatiePier in 3D printed G2LP and 5529LP bumpers/cases   
    I was able to extract the cover from Garrett's STL file and extend it a bit to fit the TRF-7970 NFC BoosterPack.  I added 6mm to it as you can see here:
     

     
    It should be able to fit with many other Boosters as well, but I haven't really tested it out.
     

     
    It sits only a few mm off of the Booster PCB so that the NFC tag is close to it.
     

     
    And here's the file for you guys to play with. 7970_5529Top.zip
  9. Like
    ILAMtitan got a reaction from D^2 in 3D printed G2LP and 5529LP bumpers/cases   
    I was able to extract the cover from Garrett's STL file and extend it a bit to fit the TRF-7970 NFC BoosterPack.  I added 6mm to it as you can see here:
     

     
    It should be able to fit with many other Boosters as well, but I haven't really tested it out.
     

     
    It sits only a few mm off of the Booster PCB so that the NFC tag is close to it.
     

     
    And here's the file for you guys to play with. 7970_5529Top.zip
  10. Like
    ILAMtitan reacted to D^2 in 3D printed G2LP and 5529LP bumpers/cases   
    Courtesy of @@ILAMtitan running the new 3-D printer in our lab. The case turns out pretty good. As you can see, we're already thinking about extending this to enclose LP + a BoosterPack. The one shown here is an NFC one, maybe a display one as well. Let's wait for @@ILAMtitan to work his 3-D design magic.   
     

  11. Like
    ILAMtitan got a reaction from LariSan in 3D printed G2LP and 5529LP bumpers/cases   
    I'm very interested in getting the STLs.  We just got a 3D printer in the MSP430 lab!
  12. Like
    ILAMtitan got a reaction from KatiePier in 3D printed G2LP and 5529LP bumpers/cases   
    I'm very interested in getting the STLs.  We just got a 3D printer in the MSP430 lab!
  13. Like
    ILAMtitan got a reaction from spirilis in 3D printed G2LP and 5529LP bumpers/cases   
    I'm very interested in getting the STLs.  We just got a 3D printer in the MSP430 lab!
  14. Like
    ILAMtitan got a reaction from KatiePier in 43oh Secret Santa - 2013   
    I received a message from my apartment complex on Thursday that a package had arrived, and thinking it was some coffee I ordered I actually put off getting it from the office.  When I picked it up, it was a clearly marked ThinkGeek box, and not my coffee at all.  Inside was a Build-On Brick Mug!!  Oddly perfect since I'm the guy in the office with the Legos in his cube,and I almost bought one a month ago.
    https://www.thinkgeek.com/product/ee3c/?srp=1
     
     

     
     
    I decide to christen it with a quick light saber duel since I didn't have any coffee; still waiting on that package.
     
     

    Thanks @@spirilis !!
  15. Like
    ILAMtitan got a reaction from roadrunner84 in 43oh Secret Santa - 2013   
    I received a message from my apartment complex on Thursday that a package had arrived, and thinking it was some coffee I ordered I actually put off getting it from the office.  When I picked it up, it was a clearly marked ThinkGeek box, and not my coffee at all.  Inside was a Build-On Brick Mug!!  Oddly perfect since I'm the guy in the office with the Legos in his cube,and I almost bought one a month ago.
    https://www.thinkgeek.com/product/ee3c/?srp=1
     
     

     
     
    I decide to christen it with a quick light saber duel since I didn't have any coffee; still waiting on that package.
     
     

    Thanks @@spirilis !!
  16. Like
    ILAMtitan got a reaction from bluehash in 43oh Secret Santa - 2013   
    I received a message from my apartment complex on Thursday that a package had arrived, and thinking it was some coffee I ordered I actually put off getting it from the office.  When I picked it up, it was a clearly marked ThinkGeek box, and not my coffee at all.  Inside was a Build-On Brick Mug!!  Oddly perfect since I'm the guy in the office with the Legos in his cube,and I almost bought one a month ago.
    https://www.thinkgeek.com/product/ee3c/?srp=1
     
     

     
     
    I decide to christen it with a quick light saber duel since I didn't have any coffee; still waiting on that package.
     
     

    Thanks @@spirilis !!
  17. Like
    ILAMtitan got a reaction from abecedarian in 43oh Secret Santa - 2013   
    I received a message from my apartment complex on Thursday that a package had arrived, and thinking it was some coffee I ordered I actually put off getting it from the office.  When I picked it up, it was a clearly marked ThinkGeek box, and not my coffee at all.  Inside was a Build-On Brick Mug!!  Oddly perfect since I'm the guy in the office with the Legos in his cube,and I almost bought one a month ago.
    https://www.thinkgeek.com/product/ee3c/?srp=1
     
     

     
     
    I decide to christen it with a quick light saber duel since I didn't have any coffee; still waiting on that package.
     
     

    Thanks @@spirilis !!
  18. Like
    ILAMtitan got a reaction from spirilis in 43oh Secret Santa - 2013   
    I received a message from my apartment complex on Thursday that a package had arrived, and thinking it was some coffee I ordered I actually put off getting it from the office.  When I picked it up, it was a clearly marked ThinkGeek box, and not my coffee at all.  Inside was a Build-On Brick Mug!!  Oddly perfect since I'm the guy in the office with the Legos in his cube,and I almost bought one a month ago.
    https://www.thinkgeek.com/product/ee3c/?srp=1
     
     

     
     
    I decide to christen it with a quick light saber duel since I didn't have any coffee; still waiting on that package.
     
     

    Thanks @@spirilis !!
  19. Like
    ILAMtitan got a reaction from KatiePier in 43oh Secret Santa - 2013   
    Dung, I expect a full redesign of the control box to include a CC3000 and MSP so that the lights can be controlled from my phone via WiFi.
  20. Like
    ILAMtitan got a reaction from JVimes in Vetinari's Clock   
    I figured you guys might be interested in some of my tinkering with the Launchpad.  Hopefully by putting a few of my projects up here it will also keep me accountable for finishing them.
     
    This is one a cobbled together a few months ago.  It's been up on the MCU projects page on E2E, so you might have already seen it: http://e2e.ti.com/group/microcontrollerprojects/m/msp430microcontrollerprojects/664670.aspx
     
     
    PROJECT OVERVIEW
    The Vetinari clock is from a book series known as Discworld, where Lord Verinari has a clock in his waiting room which has an irregular tick. The idea of the clock is to add a sense of unease and anxiety to anyone in the waiting room since their brain doesn't filter out the ticks like a normal clock. Here's a video to get a better idea of the result.  The tick is actually a lot louder in person.
     


     
    SOFTWARE DESIGN
    To accomplish this task on a 430, we create an array of possible time frames to tick the clock, and parse through it at 4Hz. The array is 32 entries long, so it equates to 32 seconds in the real world. By randomly setting 32 of the elements high, we create a timing sequence. A high element will generate a tick of the clock. This means a second on the clock can be as little as 250ms, or as long as 24 seconds, and still keep accurate time.  Check the attached software too see how it's all done; I did my best to comment it up.  main.c
     
    HARDWARE DESIGN
    The clock coil is driven via an alternating polarity pulse.  The easiest way to change a load's polarity with an MCU is using an h-bridge.
     

     
    The schematic shown is a simple implementation using two NPN and two PNP transistors.  I had the transistors and drive resistors laying around, so this part was easy to cobble together (along with the half used battery holder).  It would be easy to use a single IO pin per side of the bridge, but the transistors fit better onto the launchpad, as shown in the image.  To add the driving resistors in series, I cut a small gap in the traces, scrapped off the solder mask on either side to make pads, and put down a small SMA resistor.  It's not pretty, but it works.
     

     
    In the clock mechanism, there is a small control board with a crystal and epoxy glob IC that normally runs the clock.  I just ripped that out and directly attached the coil to the h-bridge.
     

     
    The resulting clock is actually more maddening than I expected in a quiet environment.  By using 3V rather than the 1.5V that the original movement used, the ticks are much more pronounced and do an excellent job of ruining a person's calm.
  21. Like
    ILAMtitan got a reaction from AnalysIR in Porting IR code from Arduino IDE to Energia MSP430F5529 - Clock accuracy   
    I'm not sure what the accuracy of using delayMicroseconds will be, but it looks like there might be some jitter in it due to how it process the number of cycles to actually wait.
    There is also some delay with the digital writes that will lengthen the time that you actually see the toggle.  Regardless, I don't trust it.
     
    A better method to validate clock accuracy would be to output a clock directly to a pin and measure that.  SMCLK on P2.2 would be a good choice since it's brought out on the headers.  If your scope can't measure the full 16 or 25MHz, you can just set a divider for SMCLK as well.
  22. Like
    ILAMtitan reacted to abecedarian in Vetinari's Clock   
    I know this is oriented at an analog clock, but would it be any less disconcerting if applied to digital?
     
    I know I'd be left wondering if a set of LED's sat reading "09:14:48" for a bit then suddenly counted up to "09:15:30" only to pause for a bit then up to "09:16:00"... or even ran backwards for a bit.
  23. Like
    ILAMtitan got a reaction from vicvelcro in Vetinari's Clock   
    I figured you guys might be interested in some of my tinkering with the Launchpad.  Hopefully by putting a few of my projects up here it will also keep me accountable for finishing them.
     
    This is one a cobbled together a few months ago.  It's been up on the MCU projects page on E2E, so you might have already seen it: http://e2e.ti.com/group/microcontrollerprojects/m/msp430microcontrollerprojects/664670.aspx
     
     
    PROJECT OVERVIEW
    The Vetinari clock is from a book series known as Discworld, where Lord Verinari has a clock in his waiting room which has an irregular tick. The idea of the clock is to add a sense of unease and anxiety to anyone in the waiting room since their brain doesn't filter out the ticks like a normal clock. Here's a video to get a better idea of the result.  The tick is actually a lot louder in person.
     


     
    SOFTWARE DESIGN
    To accomplish this task on a 430, we create an array of possible time frames to tick the clock, and parse through it at 4Hz. The array is 32 entries long, so it equates to 32 seconds in the real world. By randomly setting 32 of the elements high, we create a timing sequence. A high element will generate a tick of the clock. This means a second on the clock can be as little as 250ms, or as long as 24 seconds, and still keep accurate time.  Check the attached software too see how it's all done; I did my best to comment it up.  main.c
     
    HARDWARE DESIGN
    The clock coil is driven via an alternating polarity pulse.  The easiest way to change a load's polarity with an MCU is using an h-bridge.
     

     
    The schematic shown is a simple implementation using two NPN and two PNP transistors.  I had the transistors and drive resistors laying around, so this part was easy to cobble together (along with the half used battery holder).  It would be easy to use a single IO pin per side of the bridge, but the transistors fit better onto the launchpad, as shown in the image.  To add the driving resistors in series, I cut a small gap in the traces, scrapped off the solder mask on either side to make pads, and put down a small SMA resistor.  It's not pretty, but it works.
     

     
    In the clock mechanism, there is a small control board with a crystal and epoxy glob IC that normally runs the clock.  I just ripped that out and directly attached the coil to the h-bridge.
     

     
    The resulting clock is actually more maddening than I expected in a quiet environment.  By using 3V rather than the 1.5V that the original movement used, the ticks are much more pronounced and do an excellent job of ruining a person's calm.
  24. Like
    ILAMtitan got a reaction from petertux in Vetinari's Clock   
    I figured you guys might be interested in some of my tinkering with the Launchpad.  Hopefully by putting a few of my projects up here it will also keep me accountable for finishing them.
     
    This is one a cobbled together a few months ago.  It's been up on the MCU projects page on E2E, so you might have already seen it: http://e2e.ti.com/group/microcontrollerprojects/m/msp430microcontrollerprojects/664670.aspx
     
     
    PROJECT OVERVIEW
    The Vetinari clock is from a book series known as Discworld, where Lord Verinari has a clock in his waiting room which has an irregular tick. The idea of the clock is to add a sense of unease and anxiety to anyone in the waiting room since their brain doesn't filter out the ticks like a normal clock. Here's a video to get a better idea of the result.  The tick is actually a lot louder in person.
     


     
    SOFTWARE DESIGN
    To accomplish this task on a 430, we create an array of possible time frames to tick the clock, and parse through it at 4Hz. The array is 32 entries long, so it equates to 32 seconds in the real world. By randomly setting 32 of the elements high, we create a timing sequence. A high element will generate a tick of the clock. This means a second on the clock can be as little as 250ms, or as long as 24 seconds, and still keep accurate time.  Check the attached software too see how it's all done; I did my best to comment it up.  main.c
     
    HARDWARE DESIGN
    The clock coil is driven via an alternating polarity pulse.  The easiest way to change a load's polarity with an MCU is using an h-bridge.
     

     
    The schematic shown is a simple implementation using two NPN and two PNP transistors.  I had the transistors and drive resistors laying around, so this part was easy to cobble together (along with the half used battery holder).  It would be easy to use a single IO pin per side of the bridge, but the transistors fit better onto the launchpad, as shown in the image.  To add the driving resistors in series, I cut a small gap in the traces, scrapped off the solder mask on either side to make pads, and put down a small SMA resistor.  It's not pretty, but it works.
     

     
    In the clock mechanism, there is a small control board with a crystal and epoxy glob IC that normally runs the clock.  I just ripped that out and directly attached the coil to the h-bridge.
     

     
    The resulting clock is actually more maddening than I expected in a quiet environment.  By using 3V rather than the 1.5V that the original movement used, the ticks are much more pronounced and do an excellent job of ruining a person's calm.
  25. Like
    ILAMtitan reacted to roadrunner84 in Registros P1IN y P1OUT del MSP430g2152 (Registers) Help   
    P1IN will always result in a value, depending on the pin configuration this value is either the intended value on that pin or the actual value on that pin. This means that unless you have set your pin to input mode (cleared the bit in PxDIR) your PxIN will reflect PxOUT, not the actual pin value.
    setting PxREN will enable pull-up/down, clearing it will disable pull-up/down; the pin is floating or driven high/low.
    To set a pin to be pull-down and allow you to read the actual value you should:
    Set the PxREN bit to 1 (enable resistor) Set the PxOUT bit to 0 (pin outputs low (pull-down)) Set the PxDIR bit to 0 (allow PxIN to reflect the pin instead of the PxOUT value) After this PxIN will be 1 if an external circuit pulls the pin more high (short to Vcc) than the configured pull-down resistor pulls it down.
×
×
  • Create New...