Adding hardware features/improvements
to the LEGO Mindstorms RCX
Justin Fisher





There is a lot of info online about building custom Mindstorms sensors and so on, but not much (at time of writing) about improving the RCX itself. Since I have remedied though hardware some of the shortfallings of the RCX that could not be remedied through software, I thought I'd put some info online.
There are some tips for taking the RCX casing off here.

Currently, I have written up the details to one project on this page - adding a Sleep-Resume Mode for solar Lego robotics.

Standard Disclaimers

Caution: It can  be dangerous to open or modify any hardware device. Please use this information at your own risk, and at the risk of permanently damaging the device itself.

--- ---

Sleep-resume modeSetting the sleep-resume mode

Explanation:

I made this feature with autonomous robots and solar power in mind. A problem with the RCX is that it is always consuming lots of power - even when no motors are running it draws 40mA. Another problem is that once the power drops to the point where the RCX switches off, it cannot switch itself back on when the power returns. What this means for say, an autonomous solar robots is that when the sun goes down, the RCX eats through it's stored power until it switches off, wherein it can't start up again even when the sun is back and it's powerpacks are fully charged again. What the RCX needs is a sleep mode where it retains its program, and can awaken from, but draws no power (or nearly none). This modification creates this sleep mode, by switching on a monitoring circuit when the RCX switches off, monitoring the supply voltage and re-activating the RCX (then running the program) when the supply voltage has returned to levels that indicate power is available again. The circuit draws essentially nothing (micro amps).

I wanted an on/off switch for this mode, so that I could revert the RCX back to it's normal behaviour for non-solar projects, but I didn't want to cut into the RCX casing or otherwise damage it by mounting a switch on the outside of the RCX. My solution was to put a Reed (magnet-activated) switch in the circuit, and then use the absence or presence of a magnetic lego brick (A train-coupler brick) to determine whether the circuit is active:



Parts required:

All parts (except the 1381 voltage trigger) are common and widely available. You will probably need to order the 1381 online, as you won't find it in consumer stores like Radioshack, but the 1381 is so power efficient that it's worth it. All components should be physically as small as possible, because there is limited space inside the RCX. You should consider using SMD (surface mount) components if you are happy working with them. The values of most components just need to be in the ballpark and similar ones can be used instead. (Of course, the more you diverge from the circuit, the greater the chance it doesn't work as planned).

If you have an RCX from the Robotics Invention System 1.5 or 2.0, you will probably want a 4.3 or 4.7 volt Zenar diode instead of the 3.9v zenar diode listed and shown in the schematics.

Quant. Part                     Notes

3x     Resistor 37k             Similar values should also work, such as 47k
2x     Transistor BC548         Similar NPN transistors should also work - 2n2222, 2n3904, etc
1x     Transistor BC327        
Similar PNP transistors should also work - Pn2907, 2n3906, etc
1x     Capacitor 4.7uF 10V      Similar uF values ok. Any value above 10V ok. (see notes)
2x     Diode 1n9148             Any signal or rectifier diode will work, eg 1n4001, etc
1x     Diode
3.9V Zener 1N4730  Any 3.9 volt Zener. Best to get a range through. (See notes)
1x     Reed switch              The smaller the better.
1x     1381-N Voltage trigger   You'll probably need to order this. Digikey part# MN1381-N-ND

The Circuit:

Schematic1381 pinout

As you can see, there are five points where this circuit is connected to the RCX circuitboard:
If you're unfamiliar with the 1381, the pinout (for the transistor-like package) is as seen in the adjacent diagram. [-] goes to negative, [+] goes to the BC327, and [output] goes to the collector of the BC548.

Before I get into how the circuit works, I'll cover the practical stuff - where to find these connection points on the actual RCX circuitboard.
Here is a photo showing the points on the circuitboard of my (version 1.0) RCX. The boards of version 1.5 and 2.0 RCXs are slightly different, but you'll still be able to find the points - the only altered one would be the positive connection, and you can see that it connects to pin 8 of the LM2936 chip - find that chip on your board (it's in roughly the same place, but may be rotated and not facing the same direction), and connect to the same pin. (or follow the circuitboard trace that LM2936 pin 8 connects to, until you find a bigger, easier point to solder too, such as where it connects to that diode)
circuitboard
Tips:

Once the circuit is connected to those points on the RCX circuitboard, it's completed and working. The circuit itself isn't really very hard at all, so the thing that must always be at the forefront of your mind is that the circuit must be constructed so that somehow, it fits inside the RCX when you're finished.
1381 pinout
The pinout for the 1381 is as seen here.


The Size Challenge

Since the circuit is simple, the challenge is ensuring it fits in the RCX without problem. If you have a version 1.5 or 2.0, you're in luck - the lack of the power jack in these versions, while normally considered a loss, now means there is a lot of extra free space, since the casing was designed to accomodate the jack and all those caps that go with it that you can see at the bottom of the circuitboard above. If you have a version 1.0 RCX like me, you'll have to pay careful attention to how much space your circuit will take up, and where. Normally, if I need to build small, I used SMD components, but there was sufficient space here to use normal components, so I did. Some pics of how I chose to do it:

animation of space and circuit I identified this area of unused space as my preferred candidate, and built the circuit to fit.

Note that there is not as much space as appears  - that hole in the board is where a large plastic standoff/screw housing in the casing sits,  rendering much of the free space illusionary. Be sure to check there will be space when the RCX is fully assembled, not just assume that what appears to be free space, will be free.
assembled circuit
Here is a closeup of the finished circuit (as seen in place in the preceeding picture). The reed switch is seen seperately as that needed to be mounted elsewhere in the RCX.

Also present in the photo is the soldering iron tip I used to do this. A nice new sharp tip is a mere $0.99 at Radioshack, and would have made things a lot easier (and resulted in some better soldering :-) but when you're working on something, you don't want to stop to go shopping unless you have to. I include this to defer fears that building small circuits is tough. Just superglue the components to each other in the right positions, then solder the leads. Alternatively, use SMD components, or find a bigger/better lot of free space in the RCX.
circuit and parts to scale
Here is the circuit against my hand for scale, seen with the reed switch, a 1381 IC and the memory cap I used for a seperate RCX hardware modification that I haven't written up yet.

Connect the reed switch to a multimeter or buzzer and play with the magnet brick to find out where the switch needs to be in relation to the magnet to turn on, so that you can work out where to put the reed switch in the case and where to put the magnet brick on the case to turn it on. I wanted the magnet to activate it if pushed onto the studs at the centre of the bottom of the RCX, and that meant the reed switch needed to be offset from that spot pointing towards it. eg beside it. (This turned out to be great, as there were a couple of caps right there I could glue the reed switch too.)

I cannot advise strongly enough: breadboard this first. When making small/confined circuitry like this, it is a nightmare to try to troubleshoot the finished circuit if it doesn't (at least mostly) work first time. Have everything up and running perfectly on the solderless breadboard before soldering anything together. Save yourself a world of hurt.
 

How It Works and how to customize it

The basic function is that when the RCX turns off, the circuit monitors the available voltage, and when the voltage reaches the desired trigger point (about 7.7V in my case), then it holds down both the On-Off button and the Run button for a long enough period of time (about 1 second) that the RCX boots and then runs its program. Then it releases the buttons so that the user can use them, and switches itself off to conserve power. When the RCX turns off again, the circuit turns on, but it draws basically no power because it uses the 1381 voltage trigger to monitor the voltage - a chip designed specifically for low power consumption while monitoring voltage. The drain is so low you may need to set your multimeter to nano-amps or micro-amps just to register the amount of power it draws. For our purposes it's zero.

The circuit breaks up into three sub-sections:

how it works

Section 1. Auto Shutoff
- the components shown in red

This uses a transistor as a switch to turn the circuit off when the RCX is in use, and to activate the circuit when the RCX has shut down. The transistor is controlled by connecting it to a point on the RCX that is at 5V when the RCX is running and 0V when the RCX is switched off. (The photodiode pin)

Section 2: Power Monitor -
the components shown in green
This is the part that monitors the voltage, sets the trigger level of the voltage, and activates section 3 when the voltage hits that level. The  level at which a 1381 triggers is hardwired into it. If you want to trigger at 2.7V, you buy a 1381-J, if you want to trigger at 3.9V, you buy a 1381-S, and so on. But the highest trigger level available is 4.8V, and we need about 7.5V. So we use a 3.4V trigger (1381-N) and add a 3.9V Zener diode to it, resulting in the trigger voltage being 7.3V. which is roughly right (or we could use a 4.3V Zener for a 7.7V trigger threshhold.). When that level is reached, the 1381 activates the transistor which activates section 3.

Section 3: Button Pusher - the components shown in blue
This is a timer and RCX button-activator. The buttons in the RCX are both a switch that goes to ground, so this section uses a transistor as an electronic way to connect them ground and thus activate them. The two diodes are needed to ensure the buttons are not cross-wired when the circuit is off. The capacitor and resistor forms a simple timer: When the transistor in section 2 is activated, power flows into the capacitor, charging it. That power dribbles through the resistor into the transistor that activates the buttons. As soon as the RCX powers on, section one shuts off the 1381, which shuts off the transistor in section 2 that is powering section 3. But since there is still some charge left in the cap, it continues to dribble into the button-activating transistor, keeping the switches pressed, long enough for the RCX to boot and listen for a Run keypress. The Run keypress is still there, so the RCX runs. When the cap is discharged, that final transistor shuts off and circuit is entirely passive so the RCX functions as normal.


Tips:
Don't trust the stated voltage ratings of 1381s and Zeners to create your desired trigger voltage value. There is some variance among components, and it appears that some RCXs (Like the RIS1.5 RCX) lack a diode on the battery input, meaning your threshold would be 0.7v lower than expected.  I advise having a range of similar-value zeners (next step up and below), as well as signal diodes, and germanium diodes at hand, as you may need to add or substitute diodes to get the value you seek. (A signal diode can be added in series to add 0.5-0.7V, a germanium diode to add 0.2-0.4V)
Of course, it might not matter to you whether the RCX activates at 6.9v when you were anticipating 7.3, but if it does matter, you know what to do - substitute a different zener, or add in some normal diodes. I suggest 7.5V as a good target, and you could choose a 3.9V Zener to give 7.3V trigger, or a 4.3V Zener to give a 7.7V trigger. Or use a 3.9V Zener with a germanium diode to get something very close to 7.5.

Where did this magic 7.5V number come from anyway? The voltage at which your RCX activates is entirely up to you, using the methods described above. I choose 7.5V because (assuming the load of the RCX has become unsustainable due to poor light or insufficient solar collection) it's high enough for the robot to be active for a little while before it runs out of power again (mine is running on a custom solar-charged capacitor bank, not batteries, so it would not have long to run if it activated at say, 6.6V, as it shuts down at around 6.3V), and yet 7.5V is low enough that it should hopefully still reach that level if the sunlight is less than perfect, given that there are a bunch of diodes between the solar panel and the internal circuitry. In other words, if it triggers at 7.3V and your panel is producing 8V, it will not trigger, because by the time that 8V gets to the insides of the RCX, it's more like 7V. But if the panel produces 8.5V, it should reach the trigger threshhold. Basically, it depends on your power source, and what you prefer. Think about scenarios: What if the robot drove into a shadow, could it escape? This depends more on your programming than the voltage threshold, but the threshold is relevant, and difficult to change once the RCX is assembled, so give it some thought and/or experimentation. Alternatively, think about ways of making it easy to adjust the threshold voltage once the RCX is assembled and in use. For example, you could put some extra reed switches in different places in the case, each connected to a different zener. That way, where you place your magnet brick determines your voltage threashold - high, medium, or low.

A problem that can crop up if the voltage threshold is set low (and is quite likely with the suggested 3.9V zener) is that the START and RUN buttons stop working when the supply voltage gets too far above the threshhold. To fix this, connect one end of a resistor (3k7 is a good bet) to the base of the BC327 transistor, and the other end to the reed switch (on the same side the zener diode is connected). This adds a small pull-up to the base of the transistor, giving it a bit more oomph if the voltage from pin 1 is insufficient to shut of the RSM. (This would happen when the voltage is high, and the zener diode  is set fairly low, such that input voltage minus zenar voltage drop is a voltage higher than the 4.5 volts supplied by pin 1, and thus that 4.5v is insufficient to shut off the transistor).

The larger the capacitance of the cap, the longer the circuit will hold down the RCX buttons. So if the circuit is turning on the RCX, but not running the program, then it might be that a higher value cap is needed. Or it could be something simple like is a bad connection somewhere or the RCX doesn't have a program loaded to run. Conversely, if the circuit is locking up the Run button for too long, substitute a smaller cap. Mine seems to be perfect - it always activates the run correctly, and even if I immediately press run again, the key is already free to function.

The voltage rating of the cap is unlikely to be an issue, except in terms of physical size (larger voltage ratings tends to mean larger physical size). 10V and over is fine, and you'd probably have to actively search in order to find a 4.7uF cap that is rated less than 10V, so just get the smallest 4.7uF cap you can work with.

finished mods
Additional Links

A list of Lego magnet bricks at Bricklink.com (mixed with Lego fridge magnets unfortuntaely), with links to prices, available colours, etc.
Schematics of some sections of the RCX at Brickshelf.org
Digikey is a useful place to order components.
Stuff[TM] - me. I sometimes build custom electric Lego stuff for fellow enthusiests. Not really anything to see there at time of writing, so I'll also add:
My Brickshelf gallery, which is in desperate need of updating :-)

I think that probably about covers it. Have fun.

- Justin
Back to main