Most people associate Nasa with rocket science but now the American space agency has turned its attention to rocket salad. A portable greenhouse to grow lettuces was taken to the International Space Station (ISS) during last week's supply mission.

Provided that the astronauts can cut the mustard, they should be eating their first homegrown space salad before the end of the year. This will be the first time a Nasa astronaut has tasted something grown in orbit.

Until now, all supplies have been taken from Earth. But, according to Dr Gioia Massa, a payload specialist at the Kennedy Space Centre, Florida, there is no reason why this has to be the case. "If you can get the environmental conditions correct, there's no reason why plants won't grow pretty well in space," she says.

She was inspired to grow plants in space in the 1980s during an agriculture class when she was 13. Her school was within sight of the Kennedy Space Centre and she would watch space shuttle launches from the playground.

Now her deployable vegetable production system (Veggie for short) is on board the ISS and ready for business. It is a pop-up greenhouse that collapses to the size of a briefcase for stowage during launch.

The main obstacle to growing plants in space is the lack of gravity, since the soil tends to float away. Massa's solution has been to design the equivalent of something familiar to all tomato wranglers: a grow bag. The space agency calls these "plant pillows".

Three plant pillows have been taken up to the ISS and will be sown in succession. Two hold seeds for a variety of red romaine lettuce called Outredgeous. The third contains the flowering plant zinnia, to add a splash of colour to the space station.

Astronauts have sometimes taken seeds to grow in the space station during their time off because they find plants soften the stark metal and plastic interiors. Growing things also gives them a sense of passing time.

Watering plants is especially difficult in weightlessness. Instead of draining away, the water pools around the roots, effectively overwatering the plant.

Previous designs have used complicated pumps to provide drainage but the Veggie hardware does this more simply. At its base is a reservoir of water, covered with a permeable fabric. Similar fabric on the underside of the plant pillow allows the water to seep into the soil, like damp working its way up a trouser leg. A system of wicks then guides the water to the individual plants. The wicks also keep the plants upright.

Plants sense gravity, possibly using cells known as statocytes, although the exact mechanism is debated. In space, there is no up or down, so the plant does not automatically know which way to grow. Massa has glued the seeds in the correct orientation to the wicks.

Once the shoot pokes out of the soil, it will grow towards the light. This is provided by a set of LEDs built into the top of Veggie. Because plants mostly use red and blue light to generate energy by photosynthesis, the plants are illuminated by just these colours, giving the chamber a purple Star Trek-like glow.

No matter how appetising Veggie's first crop looks, the astronauts will freeze the lettuces and send them back to Earth for analysis in August. With no way to wash vegetables on the space station, Massa and her colleagues must verify that the produce is safe to eat. Only if the first lot checks out will the astronauts be allowed to grow the second pillow of lettuces to eat.

Until now, American plant experiments in space have been aimed at understanding the way weightlessness affects growth, rather than being geared towards providing the crew with a food source. This will have to change if Nasa is ever going to send astronauts to Mars: they will have to be self-sufficient because the missions will last for at least three years and will not be able to carry enough supplies.

Professor Ian Crawford, Birkbeck, University of London, is an advocate of manned exploration of space. He says: "The ability to grow food in space will become increasingly important in the context of future long-duration space missions, and especially in the context of future human settlements on the moon and Mars. These experiments are an important step in developing this capability."

In short, before Nasa can set off in search of little green men, its astronauts must develop some little green fingers.