The Rodalies R2 Line runs from Castelldefels in El Baix Llobregat to Granollers Centre in El Vallès Oriental.
The stops in Barcelona are Barcelona-Sants, Barcelona-Passeig de Gràcia, Barcelona-Clot-Aragó and Barcelona-Sant Andreu Arenal.
This line is useful for those going to the Circuit de Catalunya - the Formula One and Motorbike Race Track - at Montmeló.
Please bear in mind that if you're planning on going to the beach at Castelldefels, you should take Rodalies R2 Sud, which stops at Platja de Castelldefels.
I have included the stops on the R2 Rodalies line both as a graphic and text.
Please scroll down the page for information on train times on the R2 Castelldefels-Granollers Centre line.
As train times change seasonally, the best source of accurate timetables is the official RENFE Rodalies page.