Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


AGlass0fMilk last won the day on November 5 2014

AGlass0fMilk had the most liked content!

About AGlass0fMilk

  • Rank
  • Birthday 11/12/1995

Profile Information

  • Gender
  1. Hi there! I recently won a littleBits Workshop Set from an instructables contest for my 430-based DJ controller. I feel a bit guilty for selling a prize but I don't need these littleBits and would like to get some new tools. So I'm offering the set here for $850 + shipping (figure 10lbs, tracked/insured/signature confirmation). It retails for about $1,200 new so you can save a couple hundred. Here's a description: New littleBits Workshop Set w/ Workshop Guide Save on this great kit today! Perfect for educators, hackerspaces, kids, teens, and even adults interested in learning about electronics. See your designs instantly come to life! Many fun projects and circuits can be easily snapped together with this kit. Completely reconfigurable and reusable, fully compatible electronic parts. This kit provides a great base library of littleBits components for multiple people or simultaneous projects. An expanding catalog of fully compatible bits is growing on the littleBits website. You can order more there and expand the possibilities of this kit. An over $1,500 value! The kit retails for $1,175 + tax and shipping new directly from the littleBits website. You may save up to a few hundred dollars off the retail price if you buy here. Product description from the manufacturer: The newly reconfigured Workshop Set offers a great value with 100 modules, 10 each of our most popular modules. Suitable for up to 20 people, it
  2. I haven't checked out the new Launchpads but after developing on the Rev 1.4 MSP430G-series for so long I think I'm ready to move up. I checked out the F5529 Launchpad and it seems pretty cool! Might have to pick one up soon, I want to make more USB-based instruments/music-related electronics. They're super cheap at $12 too! I'm still amazed at how much a little IC can do. Integrated ADCs, Timers, USB, UART/SPI/I2C, it's really impressive. Thanks for the suggestion, I'm going to look at other dev boards from TI now. After getting my friend's feet wet with this instructable, he doesn't want to stop making Instructables and cool projects. Hopefully I have more for you guys soon.
  3. I said I'd post it when I was done, so here it is! It's a Laser-cut USB DJ Controller made with two MSP430G2553s and an MCP3008 ADC. Check out the Instructable I made for more information about the build. If you like it, please vote for it in the contests I entered! Thanks guys! Instructables Link Representing the 43Oh!
  4. Wow guys... I've been working with this code for so long and never even realized it was the OR operator in the if statement... I feel so embarrassed. I've been programming for a few years now, even on MSP430. Hahaha, I guess it really takes a few fresh eyes to pick out the little mistakes like that. I will recompile it with the && operator when I have the change and see how much it improves. I may try the running average idea. I could also try upping the sample count and balance the latency with the stableness of the readings. Also, the purpose of the check for absolute mins/maxs (0/1023) is so that if I have a previous sent value, for example 1018, it's in the sensitivity range so 1023 will never be sent. I will never register totally 0 or totally 1023, which is critical for my project. Therefore, I have to explicitly check to see if it's a max/min value, and then send it if it hasn't been sent before. I'll check back with you guys again if I have anymore problems. Thanks again for catching my dumb mistakes!
  5. Hey there guys. First post in a long time. I find myself developing once again on an MSP430G2553 chip on a Rev 1.4 Launchpad and I am trying to take samples from the on-chip ADCs using Energia. It's not secret that the on-chip ADCs are quite unstable (very accurate perhaps?), I don't get anywhere near the kind of jitter I see when using the MCP3008 (10-bit, 8-channel ADC converter IC). Regardless, I am very frustrated with the section of my code that deals with smoothing the signal from analog controls. I am sampling 4 ADC values and averaging it, no problem. What really frustrates me is that when I try to check if the new value is within a certain sensitivity (range) of the last recorded value, I have to do a strange work-around or else I get constant resends as if I'm not even checking if the value is in the certain range. In other words, I cannot use the compare operators greater than, less than, greater than/equal to, and less than/equal to, in order to check if the new ADC value is within a certain range of the old recorded value. To illustrate this, I will include the code I use to do this and show you what I would like to do (which doesn't work) and what I do currently (which still results in some glitches) Just for reference, this is what the Control class looks like: class Control { public: //Identification information int pin; //Sets the pin to be used by the control int ID; //Identification number (0-31) //Data processing variables int value; //Stores the current value int oldValue; //Stores the old value (for preventing constant resends) int counter; //Counter used for averaging int average; //Value use for calculating average int sensitivity; //Value used for setting sensitivity (a variable in smoothing algorithm) @todo //Constructor Control(int nID, int nPin, int nSensitivity); //Methods int Read(void); //Reads the value of the control boolean isNew(void); //Returns true if the value has updated (within a reasonable range, the sensitivity) void Send(void); //Transmits the control change to the computer for processing }; And this is what the Control.Read() function does (it includes the average code) int Control::Read(void) { int pinVal = analogRead(pin); if(pinVal == 1023 || pinVal == 0) //it is max/min { return pinVal; //I do this so that mins/maxs can be sent anyway. It's important that absolute mins/maxs are sent. } if(counter != 3) //Averaging counter that's stored on the class { average += analogRead(pin); counter++; //Increment Counter return 1025; //Not ready value (outside ADC range) } else { average /= 4; //Divide by 4 to average counter = 0; //Reset counter return average; } } } Code that I would like to use: boolean Control::isNew(void) { value = Read(); //Set value of control if(value == 1025) //Not ready return false; //First check for maxs/mins (to prevent resending) if(value == 1023 || value == 0) //it is max/min { if(value != oldValue) //max/min was not sent already { oldValue = value; return true; } } //Check if its within sensitivity setting if(value >= (oldValue-sensitivity) || value <= (oldValue+sensitivity)) //This does nothing to smooth input (constantly returns true, even when it shouldn't) return false; //Still within sensitivity, report false else { oldValue = value; //It's changed more than the sensitivity, update values and report true return true; } } return false; //If it hasn't returned true by now, return false } Code that I use right now... boolean Control::isNew(void) { value = Read(); //Set value of control if(value == 1025) //Not ready return false; //First check for maxs/mins (to prevent resending) if(value == 1023 || value == 0) //it is max/min { if(value != oldValue) //max/min was not sent already { oldValue = value; return true; } } boolean within5 = false; //Please ignore the irrelevant name of this variable int checkVal = 0; //Then check if it's within 15 of previous value for(int i=0;i<15;i++) { checkVal = value + i; if(checkVal == oldValue) { within5 = true; break; } checkVal = value - i; if(checkVal == oldValue) { within5 = true; break; } } if(!within5) //Not within 15 { oldValue = value; return true; } return false; //If it hasn't returned true by now, return false } The main loop does something like this: if(control_1.isNew()) { control_1.Send(); //Simply prints the value to the serial line } Similarly, I have tried to see if the new ADC value is above a certain threshhold as to count it as a maximum value. Above a certain value (like 1015) the sensitivity check becomes erratic, it sends new values even if they're within (for example) 2 of the last value. The code I used was: if(value > 1015) //If it's above a certain threshhold value = 1023; //Count it as a maximum The kind of output I would get is still like: 1020 1022 1018 1023 1023 1020 The sensitivity is normally set to within 10-20 for the on-board ADC. For controls connected to the MCP3008, the sensitivity is about 5, it is as stable as a rock. What is going on? Why can't I compare these values? Is it related to the type of variable I store the value in? I have tried changing the related variables to unsigned integers and it has no effect. It has had me pulling my hair out. I hate inefficient code on MCUs and using for loops simply to check if a value lies within some range seems pretty inefficient to me. I'll post the finished project when I'm done. Thanks guys!
  6. Thanks, I'll see what I can do to suppress jitter in my signal with a low pass filter. I'll get back with the results. Thank you all!
  7. As it stands, I do not think I am going to have the computer send any information so scenario 1 will be what I'm doing. I just have a general circuitry question. The launchpad in question will be in quite a noisy (electrically and audio-wise) environment (it will be a MIDI controller). How can I limit the amount of jitter in my ADC lines? A small value ceramic cap to ground? Edit: The mcu software already checks new values to see if they are within a certain number of "clicks" of the old value. I'm just wondering if there's a way through hardware to limit it in cases where there might be a lot of noise.
  8. I think the alternative method would be the best option there. Data transfer from the PC to the Launchpad will be sparse (if I do it at all) so I could just include a sender identifier bit in the commands sent to the Launchpad from the G2553. I'll try it out and check back, thanks for your help.
  9. Just to give you an idea of what I'm trying to do, I plan on programming the independent (off-Launchpad) G2553 to backpack onto a keypad (I plan on it being modular so I can use it in other projects if I want to) in order to increase the number of available pins on the main microcontroller. I will probably make it possible to get keypress data from the independent G2553 through both UART and I2C so it will be a more universal keypad solution, but for this situation I would like to use the UART so I can use the I2C pins as ADCs instead. I'll just give you a little diagram (as you did) for the two scenarios: Scenario 1, Computer is able to receive data but not send it to the Launchpad, but Launchpad can receive data from another G2553: +----------------+ | RX | | Independent | | G2553 TX |>--+ +----------------+ | | +----------------+ | | RX |<--+ | Launchpad | | TX |>-----+ +----------------+ | | +----------------+ | | RX |<-----+ | PC | | TX | +----------------+ Scenario 2, Computer can send and receive data to/from the Launchpad, and the Launchpad can also receive data from the independent G2553 (doesn't need to send data back): +----------------+ | RX | | Independent | | G2553 TX |>-------+ +----------------+ | | +----------------+ | | RX |<-------+ | Launchpad | | | TX |>-----+ | +----------------+ | | | | +----------------+ | | | RX |<-----+ | | PC | | | TX |>-------+ +----------------+ Would both/either of these be possible? And what special considerations might I need to include in the design?
  10. Hello there. For a project I am making, the Launchpad board must be able to communicate with my computer. Mostly the dataflow will be from the microcontroller to my computer, but I may introduce communication from the computer to the Launchpad sometime in the future. I am wondering a couple things at the moment (and may use this thread to ask further questions if I have any): 1. If I do not plan to have the computer send data to the microcontroller, can I have another G2553 send commands to the Launchpad using this line? (TXD to computer, RXD to another G2553) 2. If I plan to do the above, would it be possible to have the computer also communicate with the Launchpad on the RXD line as well as the other G2553 (I imagine I would use identifier bits when sending data packets to differentiate between the two sources). IE: TXD to Launchpad, RXD to another G2553 as well as the computer. I am trying to do this so I can use the two I2C pins for ADC instead. I've never done I2C or communication between two microcontrollers before so any info (other protocols/methods, etc) you think would be useful can also be included. Thanks.
  11. I have been experimenting with MSP430G2553 for a while now, I have the hardware UART sending the measured frequencies to my computer through the USB and I have successfully measured PWM'd signals accurately. I have been reading the user guides for both the family and the specific chip I have, and I came across the fact that you can set P1 and P2 interrupts to go off on rising edges, much like the Capture/Compare function of Timer_A. But since I need more than 5 capture ports (which is how many my device supports externally) I was thinking: What is the difference between having the Capture/Compare module interrupt on the rising edge and take the value of Timer_A's counter and having P1 or P2 interrupt on the rising edge and take the value of Timer_A's counter? Other than the fact that the C/C module is specifically designed for that purpose, would it be the same? This would allow me to use 1 Microcontroller in the circuit instead of 2, which is much more elegant and desirable.
  12. Thank you very much! I guess I missed that setting But the capture/ISR works, I'll post back if I have anymore questions.
  13. I have been reading the datasheet and family user guide and have found out more about the MSP430G2553's two Timer_As. For my project, I want interrupts enabled so I have written some extra code. I have also looked at demos that are designed do to things similar to what I am trying to do, but my code isn't working. There's a lot to initialize that I don't fully understand yet so bear with me. I am testing my code with a 555 timer that is set to emit around 500Hz, but nothing happens when I apply the output to P2.0 (the pin I am testing with) Here's the code: #include void main(void) { volatile unsigned int i; WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer for (i=0; i<20000; i++) // Delay for crystal stabilization { } //TA0CTL |= TASSEL_1 + TAIE; //sets Timer A to ACLK - 32768Hz Watch Crystal with Interrupts TA1CTL |= TASSEL_1 + TAIE; P1DIR |= BIT0 + BIT6; //P1.0 and P1.6 Outputs (Red/Green LEDs) P1OUT &= ~BIT0; //Red LED off P1OUT |= BIT6; //Green LED on P2DIR &= ~BIT0; //P2.0 Input //Set P2.0 to Primary Peripheral function P2SEL |= BIT0; //Sets up Capture/Compare register for Capture on rising edge and enable capture TA1CCTL0 |= CM_1 + SCS + CCIS_0 + CAP + CCIE; //Timer1_A : CCI0A - Capture on P2.0 //CC Register: TA1CCR0 _BIS_SR(LPM0_bits + GIE); // Enter LPM0 w/ interrupt } //Timer_A1 TACCR0 Interrupt Vector Handler Routine #pragma vector=TIMER1_A0_VECTOR __interrupt void Timer1A0(void) { P1OUT |= BIT0; //Turn on Red LED } But when I apply the output of the 555 timer circuit onto P2.0, the Red LED does not turn on, so what could be going wrong? What is there still to set? Sorry that the code is kinda messy.
  14. It appears that the MSP430G2553 actually has two 16-bit Timers (Timer0_A and Timer1_A)! Which I believe means I have 6 Capture/Compare channels, which is a good number for my project. The only problem is that the TACCRO1 and TACCRO2 are grouped into the TAIV interrupt vector but it probably won't be that big of a problem. EDIT: It also appears that there is no external input pin for TA0CCTL2 so I may only be able to have 5 inputs
  15. I am trying to make a frequency counter in order to experiment with the MSP430G2553. But as a beginner to microcontrollers (although not programming), it is proving harder than I thought (an operating system certainly hides a lot!) This project is supposed to be able to measure quite low frequencies (at most ~1.5kH) and I need to sample multiple frequencies at a time. From my understanding of the research I've currently done, one possible (quick) formula to measure a frequency is to start a counter at the rising edge of a frequency, and then stop it at the next rising edge of a frequency, take the value and then find the reciprocal (1/counter_value) or sample the frequency like this for multiple cycles and then find the average. I also believe that one possible way to do this is to use the Timer_A peripheral of the MSP430G2553 in capture mode, which I understand to have 3 channels for capture (which means I can determine 3 different frequencies with one chip simultaneously?). But where I am having trouble is the actual programming aspect of this project as I am new to microcontrollers and I am quickly realizing that there is a lot more to programming embedded systems than desktop computers! I have a couple of questions: Are my described methods correct/efficient/accurate? If not, what is the best formula for determining a frequency real-time (it must be done as fast as possible) Is my assumption that 3 frequencies (channels) may be analyzed by Timer_A at once correct? Or are there more/less channels available? How do I set up the Timer_A to be sourced by an external 32kH watch crystal? (Apparently Internal DCOs are notoriously inaccurate) I know I should look at the User Guide/Datasheet, but there's a lot of information in there and it is a skill itself to be able to navigate and pick out the information you need quickly, so can you point me towards certain sections/examples to help me set this up?
  • Create New...