I have only touyred in Andalucia, but generally if you get the Michelin road maps for the areas and follow the white and yellow roads, you will probably be fine traffic-wise. Even the red roads in some areas can be empty. The maps also show some very basic topography and grade information when the road gets steep.
The Rough Guide travel books are a great resource for finding accomodations and eats. What I really like is that they don't pull punches. If a place sucks, they will tell you. There is a Rough Guide to Spain. There may also be ones for particualr regions in Spain. For example, there is one devoted solely to Andalucia.
Finally, search crazyguyonabike for journals posted by riders who have done similar routes.
Looking at the one map of Spain I have handy, it looks like you might be able to avoid some mountains to the ESE of Madrid if you head ENE towards Zaragoza (which I hear is nice). However, my map does show you will have to do some climbing to get to that city.
If there is a C (Cercanias) train heading out of Madrid in your direction that might help cut down the mileage and get you to a less congested area to start the trip.
This time of year the heat is a problem. Ride early, stop between 2pm and 6pm, and cover your head -- I wear a white helmet with lots of ventilation.
Zaragoza is desert region. I did a ride from there down the Ebre river to the coast last month, and took around 6 days, including a rest day.
Mountains are where you might have to share roads with traffic. On the other hand, a lot of mountain roads are fairly empty if there's an autopista nearby with tunnels. I had some almost entirely to myself.
Michelin maps are good, and when you reach Catalunya you can use the amazing Institut Cartografic de Catalunya maps, which are world-class, and even mark footpaths.
The country is criss-crossed with GR routes, which are for hikers. Sometimes these are good for cyslists, but sometimes you'll end up pushing your bike or even carrying it.
if you're camping, you can't cook a anywhere right now. A dry summer has lead to a total ban on flames countrywide. But you're never too far from a small town or village, so you can eat there if you like. I recommend Menu del Dia, a cheap set menu available in pretty much any bar or restaurant.