Jump to content

username

Members
  • Content Count

    305
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by username

  1. username

    NRF24L / Launchpad Example CCS

    Couldn't find a simple msp430 CCS example of the NRF24L 2.4ghz so I wrote one. Requires 2 msp430g2553 launchpads and 2 NRF24L modules. Press button on 1 launchpad to toggle LED on other launchpad. Note example code assumes you know C language. *Note: Driver referenced from Brad S, supreme overlord of all C Preview of main (download for full driver set): //Author: Nathan Zimmerman //Date: 3/2/14 // Driver referenced from Brad S, supreme overlord of all C //Launchpad CCS example of NRF24L Driver. Use P1.3 Button to toggle LED on other launchpad. Hence requires 2 NRF modules & 2 launchpads //Note example uses a fixed packet length of 5. //GPIO Pinouts //P2.0 = IRQ //P2.1 = CSN //P2.2 = CE //P1.5 SCLK //P1.6 MISO //P1.7 MOSI //P1.3 Button Launchpad Rev 1.5 //P1.0 Red LED Launchpad Rev 1.5 #include "msp430g2553.h" #include "stdint.h" #include "Drivers/rtc.h" #include "Drivers/clock.h" #include "Drivers/usi.h" #include "Drivers/External/NRF24L.h" #include "Drivers/External/LAUNCHPAD_IO.h" const uint8_t txMessage[PAYLOAD_WIDTH]= "Hello"; void main(void) { uint8_t rxbuffer[PAYLOAD_WIDTH] = {0,0,0,0,0}; volatile uint8_t statusData = 0; disableWDT(); setupCoreClock(CLK_16_MHZ); setupRLED(); RLED_OFF; setupButton(); SERIAL_CLASSES spiHandle = { SPI, SMCLK_16MHZ_SPI_CLK_4MHZ, MODULE_B}; // NRF cannot run at max baud 16mhz initUSI(&spiHandle); initNRF24L(); statusData = getNrfStatus(); if(statusData != 0x0E) { while(1); // NRF failed to init, check pinout or device } while(1) { if(recievedRfData()) { getRfBuffer(rxbuffer); if(rxbuffer[0]=='H') // newb check for "Hello" Message { RLED_TOGGLE; } } if(buttonPressed) { transmitTxData((uint8_t *)txMessage); _delay_cycles(16000000); // newb button debounce } handleRxData(); handleTxData(); } } NRF_Example_NateZ.zip
  2. Hey all, Heres some code I wrote for an upcoming project which uses an ultrasound range detector. It uses a GPIO falling edge interrupt to determine time of echo pulse and uses a capture/compare pin w/ timer 1A for a ~100us pin trigger. The module is 5V so I power that off a test point on the launchpad and I use a open drain configuration bjt to get my 5V GPIO output for the trigger pin, then I use a resistor divider for the echo input. Acouple drawbacks of using these modules: -Distance measurement is relative to the module you buy -Max sampling speed is relative to the module you buy Code drawback: -Apparently the MPS430G2553 GPIO falling edge interrupts can't detect short pulses so this doesn't work for super close proximity to the sensor. /* * Author: Nathan Zimmerman * Date: 6/22/13 * * Description: A simple program to turn on a LED with the HC-SR04 * module if the module detects a object closer than 100 centimeters * * */ #include "msp430g2553.h" #include "stdint.h" //GPIO Pins #define trigger_pin BIT1 #define echo_input_pin BIT3 #define led BIT0 //Ultrasound parameters #define timer_period 62500 // 4 * 62500 = 250ms #define trigger_pulse (timer_period - 10) #define us_per_cm 14.5 // Depends on module #define time_to_trigger_us 450 #define distance_check 100 //centimeters //Statics static uint16_t echo_pulse_counts = 0; //Functions void clk_setup_1mhz(); void setup_trigger_pulse(); void setup_gpio_echo_interrupt(); uint16_t get_distance_cm(); //Main void main(void) { clk_setup_1mhz(); setup_trigger_pulse(); setup_gpio_echo_interrupt(); P1DIR |= led; P1OUT &= ~led; while(1) { if (get_distance_cm() < distance_check) { P1OUT |= led; } else { P1OUT &= ~led; } } } // End of main void clk_setup_1mhz() { BCSCTL1 = CALBC1_1MHZ; DCOCTL = CALDCO_1MHZ; WDTCTL = WDTPW + WDTHOLD; } void setup_trigger_pulse() { P2DIR |= trigger_pin; P2OUT &= ~trigger_pin; P2SEL |= trigger_pin; TA1CCR0 = timer_period; TA1CCTL1 = OUTMOD_7; TA1CCR1 = trigger_pulse; TA1CTL = TASSEL_2 + MC_1+ ID_2; __enable_interrupt(); } void setup_gpio_echo_interrupt() { P1DIR &= ~echo_input_pin; P1OUT &= ~echo_input_pin; P1IE |= echo_input_pin; P1IES |= echo_input_pin; P1IFG &= ~echo_input_pin; } uint16_t get_distance_cm() { return (echo_pulse_counts - time_to_trigger_us)/ us_per_cm; } #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { echo_pulse_counts = TA1R; P1IFG &= ~echo_input_pin; }
  3. username

    Who is using MSP430G2553?

    For hobby use with low pin counts, yes, always G2553. For commercial use or if more pins are needed, I go with freescale MCUs or whatever i'm forced to use. Yes, I likewise hate the arduino 5V... 3.3V is fine for me in every application even in low power.
  4. username

    Sensorless BLDC motor control

    Very cool that you were able to implement a stable workaround. I can't remember, did you by chance get your sensorless algorithm working? Do you have a video by chance? XD . When I did mine I used Arm core to have a bit more beef & filter options. This was a dev board I made for it, not meant to be tiny. I'll post a video hopefully in a couple days on it but i'd be awesome to see your implementation working as well.
  5. username

    Sensorless BLDC motor control

    It could be me failing at driver writing but I do all my drivers from the ground up in CCS(starting usally with the TI example code). Never touched energia. I've heard of work arounds to get glitchless opperation of TI MSP430 PWM pins but most of them involve waiting. With a BLDC sensorless algorithm, there is no time to wait and all PWM generation must be %100 consistant to reduce jitter.
  6. username

    MSP430+CC2500 board

    Hey all, Been awhile since i've posted something. Here was a small portable 2.4GHz transceiver(CC2500) that I made. This can operate via battery or USB power. USB charges the battery. Has reverse + UVLO + OCLO protection (hence all the transistors on the right portion of the board). Here is a closeup of the RF chain. I used an integrated balun to reduce component counts. I use a 0603 tripad to switch RF output between SMA & chip antenna (unpopulated in pic). I used a coplanar waveguide as a TL. System seemed to be fairly efficient. I get 2.4dBm output power when using the 0 dBm power settings. If i'm not mistaken, TI uses a dev board to measure their power output after discrete balun to SMA. Consequently, I assume the insertion loss of the integrated balun is less than their discrete balun. Someone correct me on that if i'm wrong, i'd be interested to know. I've always wondered on how one would go about verifying a discrete balun. Sorry, source files are not available. If ya know what your doing, the pictures are all ya need. XD
  7. username

    Sensorless BLDC motor control

    MSP430s have glitchey PWM operation. I wouldn't recommend them for this application. A large dev effort would be to get ideal operation out of the PWM pins which ideally shouldn't be your focus. Feel free to chime in someone if i'm mistaken.
  8. username

    Getting a RigidBot 3D printer, help me learn?

    Seems like everyone has their own 3D printer. Here is the one I got for ~330 USD. I don't need any real fancy performance. Just need basic boxes and stuff. http://www.ebay.com/itm/Folger-Tech-Prusa-i3-RepRap-Full-3D-Printer-Kit-w-Clear-Acrylic-Frame-/231301357105
  9. username

    NXP and Freescale to Merge

    This is huge news. Kinda scares me. Freescale struck me as a lot more innovative and bleeding edge where as nxp was expensive but had decent documentation(and not bleeding edge forsure). I hope all the freescale products don't double in price over this. I'm guessing we may see a few counter merges as a result of this. ST & TI?
  10. username

    DAC GUI V2

    Hey all, Round 2: This extends the peripherals of the MSP430 to a UART based ascii AT command set. For example, send "AT+GET_ADC" over the USB->Serial bridge to get all the ADC values returned. Since I released my first GUI there have been a couple others like it. You will find that this version's strength is that the underlying C driver set is my personal driver set which is quite powerful XD . I then wrote a C# GUI as a wrapper around this command set. Features Implemented: Digital IO, Analog I, PWM, SPI PWM Example: Steps to use: 1. Download code & .exe file here: https://github.com/NateZimmer/ICBM 2. Import C code into CCSV5.1 (haven't tested with other versions) and flash to launchpad. 3. Ensure UART jumpers on the MSP430 Launchpad are set to Hardware based UART on a msp430g2553 launchpad Rev 1.5 4. Run GUI and connect to launchpad. 5. Enjoy! Skip to 10:35 for setup instructions: Todo: Implement DCO Calibration for better CLK accuracy Implement I2C Implement Graphing/Logging Implement more flexible spi chip select features Please let me know if this does not work for you
  11. username

    analog.io

    Basically a new cosom/xively? Looks like a great interface with a good feature set. Very impressive. Best of luck with the site! I'll certainly keep it in mind when I run into another streaming application/project. Somewhere near the bottom of your homepage for non logged in users i'd recommend adding that pricing table. Some people won't bother registering unless they know beforehand the model of the site. Edit: Also not sure why but the login button doesn't work for me. Using firefox but it may be a adblock/firewall issue. Signup worked fine. Once I logged out I couldn't get back in.
  12. username

    What am I going to do with ...

    Hmmm.... in the spirit of 43oh you could make 229 balls of fire demonstrating your fierce loyalty towards the msp430
  13. I'm kinda creeped out by where I moved to as well and was going to do the same thing. I'd use PIR modules and ultra sound modules and have a few different nodes across my house using the NRF 2.4ghz modules. Wireless receive is expensive in terms of RF & current. I'd have a powered hub thats always in receive and have sensors that transmit every 1 - 10 seconds. This method amounts to uA of current usage average for the radio. If ~2x messages are lost or a breach message is sent, have the alarm trip. Sensors would be battery powered and need a recharge every 1-2 months. Would use a lithium + usb charging system. Disarming would require a keyfob type of rfid tag that you could wear. After a trip event your sensor could listen for the fob or if your message reaches the hub, it could ignore all breach messages. Fob would likewise transmit every 1 - 10 seconds and since that doesn't have a sensor attached to it, it could last for years on a single charge. Then perhaps the easiest way to have the web enabled would be use a ras pi or beagle bone server. On the hub you would want a full wavelength antenna such that it can pick up all the sensors in your house.
  14. username

    What am I going to do with ...

    You could create a CPU with 229 cores! You could put Intel i7 quad core to shame! Should only take a week or 2 to make. Edit: Or you could blink like 229x~30 LEDs!
  15. username

    Oven Kickstarter

    Hey guys, Glad to hear you guys got your controllers and hope they work well for you! Europe VAT tax is a beast. Sadly I can't legally mark them as a gift . US has no VAT but it has some of the highest business taxes. Social services / entitlements are very expensive . Not to get into politics but be careful what ya vote for.
  16. username

    Oven Kickstarter

    Howdy all, Excited to say I started a kickstarter for my Reflow Oven Controller: https://www.kickstarter.com/projects/1070729460/zallus-oven-controller Been working on these guys for quite a while now and would finally like to produce them in bulk. Sorry, no MSP430 =( Needed more beef & features at a lower price.
  17. username

    Board Offline

    Happy to see it back up, thanks for maintaining the site!
  18. username

    Detect if dog is on the couch

    If you bought an off the shelf weight scale those usually have force sensors(load cells) in them. However, you would risk going over their rated limit with a full couch weight (even divided by 4). Furthermore, they are probably not designed to have constant weight on them. While this may be a bit difficult / awkward, if you had a webcam/camera pointed at the couch you probably could write an image algorithm to detect your dog. Or, if there any internal points in your couch that compress based upon weight, you could use some type of sensing systems internally and trigger for small changes in deflection(aka dog on couch) but not for large deflections (humans). However, there may be spots of the couch blind to this.
  19. username

    MSP430 Nixie Clock

    3 hr to build and looks great! Note, you can download instructions on RobG's Tindie page and they are quite nice! Thanks RobG
  20. As I said before and ill say it again, datasheets not dogma but marketing brochures. You can debate datasheet specs all day but it doesn't necessarily reflect reality. After you encounter couple 100-1000 parts, you learn that datasheets are frequently wrong in some areas and are significantly mis- represented in others for the sake of sales. For example, If you have the tinniest bit of ripple on your supply, or are not in a fully anechoic temperature/humidity controlled vacuum chamber(on the ISS), you may very well see results differ by 10-100x. I learned this after I dealt with a product that had to survive a long long time off a single non rechargeable battery and I had to account for every 0.1uA used. You would read the datasheet, it would perform differently, you would ask the reps, and sometimes it was user error and sometimes the part simply could not realistically perform as claimed. If I had to make any judgments of geko vs. msp430 in terms of power usage for a given application, i'd get dev boards for both and actually test it. Write sudo software that turned on all the modules I needed & sleeped...ect. Then you arrive at the next great challenge which is accurately counting coulombs. This is tricky when you have a common power cycle of minutes+ and current draw usages that differ by 40db depending on states. Makes accurate integration really tricky over a long period of time and huge range.
  21. Low power is a fun nut to crack. The current usage figures in datasheets are generally marketing figures. I'd be best to grab a dev board for both processors your interested in and play around with a uA meter and the software features you know you need. Keep in mind that RF usually requires a decent amount of power for any type of range. Powering the processor may be peanuts compared to completing a transmission with any decent range.
  22. username

    MSP430 Nixie Clock

    awww this makes it harder to use the additional shocking features none the less, please take my money
  23. username

    HC - SR04 Ultrasound Module Driver Code

    1MHz clock makes math easy, no other reason. Yes the mosfet can generate a 5V pulse with the circuit shown. Yes, you should be able to port this to other MCUs though if their core clocks are different you may have to tweak the math to get the proper distance.
  24. username

    HC - SR04 Ultrasound Module Driver Code

    The trig pin on the module wants to see a 0-5V digital input. The msp430 only has a 3.6V input max. That mosfet works as a 3.6V to 5V converter. Since its a 5V module I did this to be safe though i'm not sure its required. It might tolerate lower voltage inputs. Use any basic mosfet that can handle a 3.6V gate voltage. A 2n7007 is a basic FET that should work. As for how a mosfet works, see wikipedia. If your asking as to how the trig pin works on the module, see the module datasheet.
  25. username

    MSP430 Nixie Clock

    Hooray! can't wait! Is the power board needed for the clock kit or is that already onboard?
×