LunchPada MSP430 review and test project

    Recently, thanks to the user Dooez , I ordered myself an inexpensive set for TI to play with on cold winter evenings.
    Literally a few days later I knocked at me “with a thick shoulder bag ...” and a wonderful FedEx box courier: The

    contents of the box did not disappoint me either. Inside was a smaller box

    from which the LunchPad board itself was sequentially removed:

    sealed bags with another processor, connectors for the board and

    32 kHz quartz: a short mini USB cable

    and, as a bonus, a couple of stickers

    First of all, of course, we unpack the board and laces and stick into the comp. Winda happily offers to search for drivers and, of course, finds nothing. Not scary. We download the pirated IAR Embedded WorkBench from torrents (of course, you could take the trial version from the TI website, but adherents of the Church of Copyism are not looking for easy ways), and after installation, the programmer / debugger and virtual COM port appear in the system.
    Initially, a demo program was flashed into the processor, flashing an LED depending on the temperature (yes, the percent, for all its simplicity, can measure its temperature), which we immediately erase with our simple program “blink the LED”, a kind of “Hello, World!” for embedders.
    I would especially like to note the ability to download from the TI website an archive with a couple of hundreds of tiny (literally ten lines) programs in C and Assembler that demonstrate the features of the microprocessor. As soon as something did not work out, I just loaded the corresponding example into the processor, and in the debugger I found the essence of the problem in a few minutes.
    By the way, debugger. Great thing! Breakpoints can be set both on the command and on the fulfillment of any condition, plus the ability to stop the processor by changing the bits in the service registers and immediately receive a response in the hardware on the board. Or vice versa, look directly at the processor registers for the reaction to the external influence.
    Having played enough, I got the idea to create something useful. And as you know, the beast runs to the catcher.
    In the old Chinese oak electric screwdriver, the batteries had just died by this time. And in the zashashnik lay brand-new iron-phosphate accumulators purchased on occasion, which all hands couldn’t reach:

    The main plus of the 430 series (according to TI) is ultra-low power consumption. The processor simply asks for some kind of self-powered device. So let's try to make a screwdriver controller instead of Chinese junk.
    So, we disassemble the screwdriver and ruthlessly throw out its dull contents:

    and check that the battery comes in perfectly (if you break out a couple of partitions) and there is still room for a small controller board:

    I pretend to be on my knee an approximate circuit of internal electronics from those parts that are scattered around all kinds of boxes and bags (by the way, because criticism of the selection of components is not accepted, I soldered from an existing one in the house, I didn’t want to rush to the radio market in the cold):

    A small explanation for the circuit: for charge Uses a USB port. It can produce 500mA at 5 volts, on a battery of this type, the cut-off voltage should be 3.6 volts (working 3.3V), so we put it on a charge current of 100mA when the voltage drops to 1.4V, i.e. add a small current-limiting resistor to the key resistance. Q2, Q3 are needed precisely for cutting off when the battery is fully charged. Plus, the same cutoff is triggered by overheating.
    Q4 controls the motor (switching the direction there is done mechanically, so I did not have to bother with full-bridge), it is taken more powerfully, because the motor at startup takes up to 3A from the battery.
    D1 reduces the microprocessor power supply voltage to acceptable values.
    R14, R18 measure the battery voltage, R16 and R19 measure the input voltage.
    S1 - a large button on the screwdriver that turns on the motor. S2 and D2-D4 - a tiny scarf (yes, I didn’t throw out all the Chinese junk) with a button and three LEDs, red, yellow and green, showing the battery charge.

    To begin with, I connect a variable resistor representing the battery and a board with indicators to the legs of LunchPad. The motor and key depict the LEDs on the board:

    I achieve more or less confident work of all pieces of the program on the layout and proceed to the assembly of the final board. First, we check the geometric dimensions after installing the keys:

    Normally, they fit the size, you can solder the spare microprocessor, attach the necessary SMD components to it and make all the connections using a thin MGTF:

    (Yes, in this picture there is an assembled board with all the components sealed. Wire in red heat shrink - connecting the programmer to the processor, then it will be removed)
    Now, from the blinking of the LEDs, we turn to the torsion of the motor. LunchPad with a slight movement of the hand turns into a programmer, and the variable resistor temporarily migrates to the finished board in order to check the critical limits of the battery without tormenting the battery itself:

    Along the way, we check different sleep modes for the processor. Even with full power-saving, our result is one and a half orders higher than that stated in the documentation, which is not surprising given the resistor dividers for the ADC and the Q2 control circuit. However, 40 microamps are quite acceptable for several ampere-hours of battery life. For ten years the processor will work exactly on one charge, and there, either the checker will die or the ass:

    Well, everything, the LEDs blink as expected, the voltage is measured, overheating (simulated by a hairdryer) disconnects the load, charging when plugged into USB turns on - you can collect it.
    Gently stuff the filling inside the case

    and twist both halves

    now you can, with a clear conscience, upload your sources to a public repository, because the main commandment of fans of copyism is “Information must be free!”. Who is interested in the project - you can download the latest version of the source and the Altium scheme from here .
    There, of course, comb and comb - there are still tails in the software from the original version of the program with FSM, in the future I abandoned it in favor of sleep-modes, but in the diagram the numbering of the elements is a bit strange after running in the simulator and erasing the excess parts .

    How can I improve the circuit: well, at least instead of a wire, use a miniUSB mother in the screwdriver case, because the dangling wire is not according to Feng Shui.
    Another option for aesthetes: after Q2, the inductance and the Schottky diode are set according to the pulse-step-down converter circuit, then the microprocessor using the PWM can charge the battery from any input voltage.
    The serial port remained unused on the microprocessor - it is quite possible (using a converter of the type CP2102 or FTDI) to tell the computer the statistics of the charge-discharge of the battery.

    The design itself will then be the basis for tourist battery charging for cell phones / overnight lamps that can be recharged from Peltier, solar panels and dynamos. But this is the topic for the next article on Habr.

    PS: In general, it’s just a brain rupture - what would I have thought if I had been told 20 years ago that I would sit at a computer and program a screwdriver? Another ten years, and learn how to hack toothpicks.

    Also popular now: